Home>Article>Backend Development> How to set the page in php so that it cannot go back

How to set the page in php so that it cannot go back

藏色散人
藏色散人 Original
2021-09-13 09:54:44 2299browse

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.

How to set the page in php so that it cannot go back

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!

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