/** * 得到有效的搜索词 * @param $keyword * @param string $method * @return string */ public static function getValidSearchKeyword($keyword, $method = 'AND') { $sep = strtoupper($method) === 'AND' ? ' AND ' : ' '; return $keyword ? urlencode(join($sep, array_unique(Util::explode(' ', str_replace(' ', ' ', $keyword))))) : ''; }