Event: Action $_session[' Start ' in a file = ' yes ';
Sleep (100); Sleep 100s
In this dormant time period, the B file Operation $_session[' start ' = ' no ';
Result: File B has been waiting until the end of a file hibernation is performed
Reason: Through Google search, learned that there is a read and write lock session
When the session_start () is executed, the operation of the session on the page is saved in memory until the end of the page execution is written in the session file. During this time, other documents will wait for the session operation;
The session will be locked. Until the completion of the page execution, the content from memory to write to the file;
Workaround: Manually write the data to the session file by calling Session_write_close () and end the session, and the other file does not have to wait to immediately operate the session. But the session is closed and needs to be called at a time
Session_Start () method, open session;
A file:
<?phpsession_start (); $_session[' start '] = ' aaaa '; session_write_close ();//Writes data to the SESSION file, and end the session process sleep (); session_start (); Echo $_session[' Start '].microtime ();
B file: In the time period of the A file sleep, modify session value
<?phpsession_start (); $_session[' start '] = ' bbbbb '; Session_write_close (); session_start (); Echo $_session[' Start '].microtime ();
"PHP" session read/write lock