Session_Start () How to use?
This post was last edited by xwmr1988 on 2013-11-05 16:07:59
PHP.ini in Session.auto_start=0
Page One index.php:
if (Isset ($_post[' submit ')) {
$_session[' season ']=$_post[' season '];
Header (' Location:test.php ');
}
?>
Storage Sessions
Select the data you want to set:
Page Two test.php:
Session_Start ();
?>
$season =$_session[' season '];
Echo ' read session
';
Switch ($season) {
Case ' Spring ':
Echo ' is now a green spring ';
Break
Case ' Summer ':
Echo ' is now a passionate summer ';
Break
Case ' Fall ':
Echo ' is now a fruitful autumn ';
Break
Case ' Winter ':
Echo ' is now snowy winter ';
Break
Default
Echo ' Sorry, there is no data in the session, or the session does not exist. ';
}
Run Page One:
Submit to page two:
Why does this warning appear? How to solve? In addition to setting session.auto_start=1
share to:
------Solution--------------------
Confirm test.php No BOM header