For example: Now there are 1, 2, 3. 3 pages. It is hoped that the user will visit the first page at the beginning, then click "Next" to see the "second page", and then the user cannot
go back before entering the "third page". Let 1 and 2 be the same page. Leave a mark in the session, like this:
1and2.php
Copy the code The code is as follows:
php
session_start();
if (isset($_GET['p2'])) {
$_SESSION['enteredPage2'] = true;
}
if (isset($ _SESSION['enteredPage2'])) {
//Output page 2. In page 2, the link to page 3 is as follows
echo "This is page 2.
Page3At this time, we cannot go back to P1~";
} else {
//Output page 1, including the link to page 2 as follows
echo "This is page 1. ;a href="?p2=">Page2";
}
?>
The following is 3.php, which indicates that the user has completed the visit P2, you need to allow users to access P1
Copy code The code is as follows:
session_start( );
unset($_SESSION['enteredPage2']);
?>
In the above example, page 1 and page 2 are both temporary pages generated by 1and2.php. When the user's browser wants to read this address, the output page 2 is page 2. Don't worry that the user
will return to page 1. This is the most fundamental solution that is browser-independent.
http://www.bkjia.com/PHPjc/825224.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/825224.htmlTechArticleFor example: Now there are 1, 2, 3. 3 pages. It is hoped that the user will visit the first page at the beginning, then click "Next" to see the "Second Page", and then before entering the "Third Page", the user cannot continue...