1. 程式人生 > >thinkphp3.2路由分頁實現

thinkphp3.2路由分頁實現

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改成上面的, 如果會配置路由的話上面應該就能看懂是怎麼回事