error message:Warning:session_start () [Function.session-start]: Cannot send session cache Limiter-headers already sent
Cause: If there is output before session_start (), there will be an error,
Workaround: add Ob_start () before Session_Start ();
index.php
Copy the Code code as follows:
Error_reporting (-1);
Ob_start ();//Do not add error, cannot write session
Register_shutdown_function (' close ');
Echo 1;
Session_Start ();
$_session[' password ']= ' mima2ddddddddddddddda2 ';
function Close ()
{
if (session_id ()!== ")
@session_write_close ();
}
?>
Index2
Index2. Php
Copy the Code code as follows:
Error_reporting (-1);
Ob_start ();//Do not add error, cannot read session
?
Echo 1;
Session_Start ();
echo $_session[' password '];
Var_dump ($_session);
?>
Index
http://www.bkjia.com/PHPjc/824915.html www.bkjia.com true http://www.bkjia.com/PHPjc/824915.html techarticle error message: Warning:session_start () [Function.session-start]: Cannot send session cache Limiter-headers already sent reason: Before Session_Start (), if there is output content, ...