thinkphp3.2路由分页实现

来源:互联网 发布:c罗 知乎 编辑:程序博客网 时间:2024/05/18 01:48
public function show() {        if(0 == $this->totalRows) return '';        /* 生成URL */        $this->parameter[$this->p] = '[PAGE]';        //$this->url = U('Movie/'.ACTION_NAME, $this->parameter); 原来的        $request_url = $_SERVER["REQUEST_URI"];        if(!preg_match("/\/p\/\d+/", $request_url)) {            $request_url = str_replace(".html", '/p/'.urlencode('[PAGE]').'.html', $request_url);        }        $this->url = preg_replace("/\/p\/\d+\.html/", '/p/'.urlencode('[PAGE]').'.html', $request_url); 


找到ThinkPHP/Library/Think/Page.class.php文件  找到里面show方法  将原来的$this->url改成上面的, 如果会配置路由的话上面应该就能看懂是怎么回事

原创粉丝点击