我有多個頁面的分頁功能。獲取分頁的當前URL
而不是在函數中設置URL。例如mypaginatefunction($current_page_number, 'forum/?action=showthread&id=$threadid, $per_page
我只是想讓PHP弄明白。
目前我使用:
$link = strtok($_SERVER['REQUEST_URI'],'?').'?'.http_build_query($_GET);
<a href=\"$link&page=$page_number\">$page_number</a>
但是,這並不工作這麼好。它會保留以前的$ _GET太
例如可以說我對http://xxx/forum/?action=showthread&id=181
我按2頁http://xxx/forum/?action=showthread&id=181&page=2
上,但然後如果我按3頁就變成:http://mysite/forum/?action=showthread&id=181&page=2&page=3
我只想要&page=3
我該怎麼辦?
剛剛更新。我在原始答案中有錯誤。 –