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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章