Home >Backend Development >PHP Tutorial >How to jump to the page before login in thinkphp after logging in?

How to jump to the page before login in thinkphp after logging in?

WBOY
WBOYOriginal
2016-12-01 01:27:512206browse

If you use $_SERVER['HTTP_REFERER'], the full path is given. After successful verification, redirect does not support full path jump, and the page before the user logs in has parameters, such as this http://localhost/a/jz /index.php/Home/Test/test.html?t=10311244 What to do in this situation?

Reply content:

If you use $_SERVER['HTTP_REFERER'], the full path is given. After successful verification, redirect does not support full path jump, and the page before the user logs in has parameters, such as this http://localhost/a/jz /index.php/Home/Test/test.html?t=10311244 What to do in this situation?

http://localhost/a/jz/index.php/Home/User/login?redirect=/Text/test.html

Save the URL in the session before logging in, take it out after completion, and then redirect

You use the redirect() function to redirect the full path

<code>redirect("http://google.com");</code>

<code> echo "<script>history.go(-1);</script>";  </code>
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