So if I start a session on one page, then send information via $_SESSION
should I put session_start()
at the top of the new page?
For Example:
page1.php:
session_start();
# code makes $foo
$_SESSION["var"] = $foo;
header("LOCATION: page2.php");
die;
page2b.php:
$foo = $_SESSION["var"];
# code uses $foo somehow
Does page2.php need session_start.php
at the beggining of it? Especially if the only way to access it was through a page that starts a session?
是的...在每个页面中您都应该开始一个会话
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.