It's easy to report an error for a session. who can explain it?-php Tutorial

Source: Internet
Author: User
The error message for a session is very simple. who can explain it (! ) Notice: A session had already been started-ignoring session_start () in D: \ php2 \ wamp \ www \ shop \ top. php on line 2
Call Stack
# Time Memory Function Location
1 0.0010 177552 {main} () .. \ index. php: 0
2 0.0020 183496 include ('d: \ php2 \ wamp \ www \ shop \ top. php ') .. \ index. php: 8
3 0.0020 183528 session_start () .. \ top. php: 2

Who can help explain what this error means? the first line is that the session is enabled repeatedly? what are the following lines? time and memory?
Thank you!


Reply to discussion (solution)

This is because the session_start () function is used multiple times on the page.
There are two solutions:
1) in php. ini file set session. autostart to 0 configure php. ini to set session. autostart = 0
Session. auto_start = 0
2) In your code use this line In the error page, edit your code as follows:
If (! Session_id () session_start ();
Instead
Session_start ();

This is because the session_start () function is used multiple times on the page.
There are two solutions:
1) in php. ini file set session. autostart to 0 configure php. ini to set session. autostart = 0
Session. auto_start = 0
2) In your code use this line In the error page, edit your code as follows:
If (! Session_id () session_start ();
Instead
Session_start ();

What are the meanings of the following lines?

Indicates the location of your call

You 'd better write session_start () in a method to check whether the session is enabled. then you can call the method to set/call the session.

The following lines also indicate that you have repeatedly called session_start ()

A session had already been started-ignoring session_start ()
Session_start () is repeated.
This is an error warning for php5.4. it is unfriendly!
@ Session_start ();
Block it.

The following is the call stack information provided by xdebug.
Time: The start Time of execution, in seconds.
Memory usage in bytes
Function execution Function
Location File: Line

You have repeatedly called session_start ()

Related Article

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.