开发者

why can't outputing anything before Session_Start()?

开发者 https://www.devze.com 2023-02-03 11:54 出处:网络
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 sta

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

精彩评论

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

关注公众号