Warning: session_start(): Cannot send session cookie – headers already sent by (output started at /www/users/oemyes.com/index.php:4) in /www/users/oemyes.com/includes/functions/sessions.php on line 102
上面的问题找了好久,终于找到方法了,原来就是在index.php第4行前输出了一个HTML头部代码,导致在session_start()之前输出内容,而报错……
把session的相关代码写在第一行,就没问题了,原因是:
session_start()应该写在页面顶端,如果前面有空行的话,php就认为是有输出了……,所以就会报此类错误,所以请注意,session_start()记得顶头写。
版权所有,转载请注明出处。
转载自 <a href="http://www.yanghengfei.com/archives/107/" title="session_start():Cannot send session cookie – headers already sent by" rel="bookmark">session_start():Cannot send session cookie – headers already sent by | 星外飞客 </a>
我简单说几句