note 120951 deleted from function.session-write-close by peehaa

From: Date: Fri, 07 Apr 2017 09:10:52 +0000
Subject: note 120951 deleted from function.session-write-close by peehaa
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-208997@lists.php.net to get a copy of this message
Note Submitter: kevinsir at qq dot com ---- session_write_close() not commit until script execute complete? I test this script in chrome. <?php session_start(); if(isset($_SESSION['ddd']) && $_SESSION['ddd']) { exit("SESSION is set"); } else { $_SESSION['ddd'] = true; session_write_close(); //session_commit() is also not work sleep(5); exit("SESSION is working"); } ?> I open the php file in chrome, it echo "SESSION is working" after 5 seconds When I open the file in a new tab in 5 seconds it echo "SESSION is working" not "SESSION is set" However when I open the file in a new tab after 5 seconds it echo "SESSION is set" Why? session_write_close not commit session immediately? If I want to commmit session immediately,how can I do?

« previous php.notes (#208997) next »