ThinkPHP3.1.3在启用路由的情况下,其分页地址不是路由的地址,由于thinkphp3.2.1的代码也没有修复,很多人都遇到了这一问题,本文采纳olcms的修改方法解决这一问题,特别感谢phper jack对此做出的贡献,具体解决办法是修改ThinkPHP的functions.php的U方法,在287行左右:
if(!empty($vars)) { // 添加参数 foreach ($vars as $var => $val){ if('' !== trim($val)) $url .= $depr . $var . $depr . urlencode($val); }
后面加入以下代码
/* * tp开启路由之后下一页路由失效问题 分页类URL组装 */ //如果开启路由 if(C('URL_ROUTER_ON')){ foreach (C('URL_ROUTE_RULES') as $zhaolg => $zlig){//遍历路由 if(strstr('/'.GROUP_NAME.$url,$zlig)){//从网址中找路由规则 $lg = strstr($zhaolg,'/:');//分析规则 带参数? if($lg){//如果规则带参数 $tempzlg = str_replace('/:','',$lg);//取参数 //dump($tempzlg); if($tempzlg){ if(C('APP_SUB_DOMAIN_DEPLOY')){ $zlgurl = str_replace($zlig,$zhaolg,'/'.GROUP_NAME.$url); //url替换为路由规则 }else{ $zlgurl = str_replace($zlig,$zhaolg,$url); //url替换为路由规则 } //注 /s/:c/c/4/p/__PAGE__ //dump($zlgurl); $url = str_replace($lg.'/'.$tempzlg,'',$zlgurl);//url替换路由规则参数 } }else{//分析规则 不带参数 if(C('APP_SUB_DOMAIN_DEPLOY')){ $url = str_replace($zlig,$zhaolg,'/'.GROUP_NAME.$url);//url替换为路由规则 }else{ $url = str_replace($zlig,$zhaolg,$url);//url替换为路由规则 } } } } }
至此问题得以解决!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver Mac version
Visual web development tools

Notepad++7.3.1
Easy-to-use and free code editor

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment
