获取用于分页的当前URL


Get current URL for paging

所以我想知道一些事情。

而不是在函数中传递URL,例如:

paginate('SELECT * FROM posts WHERE topic_id = $id', 'forum/?action=thread&threadid=292', $perPage)
paginate('SELECT * FROM news_comments WHERE news_id = $id', 'index.php?action=comments&id=17', $perPage)
paginate('select * from ?', 'another page', $perPage)
paginate('select * from ?', 'another page', $perPage)

我想让php计算出当前的url/脚本。显然,这不起作用(好吧,它确实起作用,但我的意思是看看它)

$_SERVER['REQUEST_URI'];
forum/?action=thread&threadid=10&page=2&page=3&page=4&page=5&page=6&page=7&page=8&page=9

我只想要当前的$_GET['page']

有什么建议/想法吗?

可能传入current_page变量?

forum/?action=thread&threadid=10&current_page=5&page=2&page=3&page=4&page=5&page=6&page=7&page=8&page=9

然后你可以做:

$_GET['current_page']