Session_Start () How to use

Source: Internet
Author: User
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
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.