In daily development, php.ini configures session.auto_start=0 by default. When the session is closed by default, if you want to open the session, you need to call session_start:
- session.auto_start. Session_start() is automatically completed when it is opened
- Difference It depends on whether session_start() is needed before using SESSION;
-
When session.auto_start = on, execute
session_start() will generate a new session_id
- session.auto_start = on The advantage is that errors will not be caused by forgetting to execute session_start() or not positioning session_start() in the program at any time
- The disadvantage is that if you are using third-party code, you must delete all session_start() in it. Otherwise, you will not get the correct results
The above introduces the difference between opening and closing session auto_start in phpini, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.