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
精彩评论