Errors With PHP Session [duplicate]
Just wondering if there are any alternative ways to use session_start()
and also having my header.php
in every page without getting the below warning? Help?
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent
Here's the code.
<?php
session_start();
?>
<? include('header.php'); ?>
You should be calling session_start()
before any output. Why can you not move the two around?
Make sure nothing is output when you run session_start()
, it should be run once at the very start of your web page being requested.
This issue doesn't need resolving via JavaScript, you just need to restructure your code.
Yes, you have to use session_start() before outputing anything.
If you use session_start() before including you header.php, this should work.
Start your session before you include header.php
精彩评论