thinkphp5.1 method to implement retreat: 1. Add constants in "common/function.php"; 2. Call ""; 3. Just add javascript code to the page for the jump operation.
The operating environment of this tutorial: Windows 7 system, thinkphp version 5.1, Dell G3 computer.
How to implement retreat in thinkphp5.1?
Thinkphp implementation plan for returning to the previous page
In the development process, the function of returning to the previous page is often used. Here I provide an idea For reference only, welcome to discuss
The implementation process is as follows:
1) Add constants in common/function.php
//当前页面的完整URL地址,用于操作返回上一页 defined('CURRENT_URL') or define('CURRENT_URL',base64_encode($_SERVER["REQUEST_URI"]));
2) Use the method at the link that needs to be returned Call
<a href="{:U('User/logistics?return='.CURRENT_URL)}" target="blank">添加收货地址</a>
3) Add javascript code in the page of the jump operation
<script> var return_url = "{$Think.get.return|base64_decode}"; if(return_url){ //延时跳转 setTimeout(function () { window.location.href = reurl; },1500); } </script>
The jump link uses base64 encoding to avoid pathinfo mode url parameter conflict
Recommended learning: "thinkPHP Video Tutorial"
The above is the detailed content of How to implement retreat in thinkphp5.1. For more information, please follow other related articles on the PHP Chinese website!