For example, a Web site has a few unrelated pages in the same directory: 1.php,2.php,3.php
A user generates a cookie after accessing 1.php:
Setcookie (' Mycookie1 ', $c 1);
Setcookie (' Mycookie2 ', $c 2);
Setcookie (' Mycookie3 ', $c 3);
If this user clicks the hyperlink from another website into 2.php, the result cannot read the cookie value of 1.php setting in 2.php.
If I do a hyperlink in the 1.php to 3.php, from the 1.php point hyperlink Access 3.php, on the 3.php will be able to display my 1.php set the cookie value:
The code for both 2.php and 3.php is the same:
$CC 1 = $_cookie[' mycookie1 ');
$CC 2 = $_cookie[' mycookie2 ');
$CC 3 = $_cookie[' mycookie3 ');
echo $CC 1;
echo $CC 2;
echo $CC 3;
How can I read the cookie value of 1.php settings in a 3.php page that is fully associated with 1.php?
Reply to discussion (solution)
Set the expiration period of a cookie variable