PHP 提供功能session_write_close。我想检查会话是否已关闭。session_id()仍然返回值。
session_start();
//
// Some code there
//
session_write_close();
//
// Some code there
//
if( /*is session write closed?*/)
echo 'Session closed';
else
echo 'Session still opened';