[英]How to make the back to pagination button go back to previous pagination page
I have added a Back To Gallery
button which appears in the image showcase page for a photography website gallery. 我添加了一个“ Back To Gallery
按钮,该按钮出现在摄影网站画廊的图像展示页面中。
However when the button is clicked it goes back to the pagination's first page, I would like the button to direct the user back to the previous pagination page when clicked. 但是,当单击按钮时,它会返回到分页的第一页,我希望在单击该按钮时可以将用户引导回上一个分页。
As an example if the image clicked was in pagination number 22 when the image is clicked and after user views the image and want to go back the button has to take the user back to pagination 22 not going back to pagination 1. 例如,当单击图像时,如果单击的图像在分页号22中,并且用户查看图像并想返回后,该按钮必须使用户回到分页22,而不要回到分页1。
With php you can relocate a user with 使用php,您可以使用
header('Location:'.$_SERVER['HTTP_REFERER']);
$_SERVER['HTTP_REFERER']
stands for de user his previous page $_SERVER['HTTP_REFERER']
代表取消用户的上一页
With javascript you can relocate a user with 使用javascript,您可以使用
<a href="#" onclick="window.history.go(-1); return false;" class="btn btn-primary">
<i class="fa fa-undo"></i>go back
</a>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.