Home>Article>Backend Development> How to set the page in php so that it cannot go back
How to set the page to be unable to go back in php: 1. Open the corresponding PHP page; 2. Set the code "header("Cache-control:no-cache,no-store,must-revalidate");" Disable page regression.
The operating environment of this article: Windows7 system, PHP7.1 version, DELL G3 computer
How to set the page in php not to go back?
PHP header() prohibits the page from going back
The code is as follows:
header("Cache-control:no-cache,no-store,must-revalidate"); header("Pragma:no-cache"); header("Expires:0"); header('Location:http://www.xxx.com');
Related introduction:
The header() function sends the original to the client HTTP header.
It's important to realize that the header() function must be called before any actual output is sent (in PHP 4 and above, you can use output caching to solve this problem):
Grammar
header(string,replace,http_response_code)
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to set the page in php so that it cannot go back. For more information, please follow other related articles on the PHP Chinese website!