"; 3. Just add javascript code to the page for the jump operation."/> "; 3. Just add javascript code to the page for the jump operation.">

Home  >  Article  >  PHP Framework  >  How to implement retreat in thinkphp5.1

How to implement retreat in thinkphp5.1

藏色散人
藏色散人Original
2022-12-05 09:53:051097browse

thinkphp5.1 method to implement retreat: 1. Add constants in "common/function.php"; 2. Call "a079f723fbda0fde85821e8a275902425db79b134e9f6b82c0b36e0489ee08ed"; 3. Just add javascript code to the page for the jump operation.

How to implement retreat in thinkphp5.1

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(&#39;User/logistics?return=&#39;.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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn