开发者

why can't outputing anything before Session_Start()?

I can't figure out why ,anyone 开发者_开发知识库any help?


simple: session_start sets your php session cookie, and cookies can only be set in the http header. php must send the header before it can start sending content. so as soon as you start to output content, php implicitly sends the http header and thus disables changing header values.

a common way to prevent this is to use output buffering - see http://php.net/manual/de/ref.outcontrol.php

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜