首页 > 代码库 > CI框架设置suffix后缀分页错误和路径错误解决办法!

CI框架设置suffix后缀分页错误和路径错误解决办法!

Pagination类进行设置如下,防止分页错误:(return $output之前)

//分页设置suffixif($CI->config->item(‘url_suffix‘)){$url_suffix=$CI->config->item(‘url_suffix‘);$output=str_replace($url_suffix,‘‘,$output);$output=preg_replace("/\/([0-9]+)\"/","/\\1".$url_suffix."\"",$output);    }//分页设置suffix

Config.php设置如果路径结尾带?参数错误(CI框架默认site_url 函数修改)

if($suffix){$ci_url = $this->slash_item(‘base_url‘).$this->slash_item(‘index_page‘).$this->_uri_string($uri).$suffix;$output=str_replace($suffix,‘‘,$ci_url);$output=str_replace(‘?‘,$suffix.‘?‘,$output);return $output;}else{return $this->slash_item(‘base_url‘).$this->slash_item(‘index_page‘).$this->_uri_string($uri).$suffix;}

 


CI框架设置suffix后缀分页错误和路径错误解决办法!