|
![]() |
名片设计 CorelDRAW Illustrator AuotoCAD Painter 其他软件 Photoshop Fireworks Flash |
|
请看具体的错误程序和输出结果 <html> <? echo "testing ... "; session_start(); ?> </html> 输出为 testing ... Warning: Cannot send session cookie - headers already sent by (output started at F:php2000test.php:2) in F:php2000test.php on line 4 Warning: Cannot send session cache limiter - headers already sent (output started at F:php2000test.php:2) in F:php2000test.php on line 4 分析: 主要原因,php.ini里有关于session 的定义,默认是使用 cookie [session] session.use_cookies = 1 ; whether to use cookies 这句表明使用 cookies 存储session 而 cookies的设置必须在正式 htm 之前,也就是只能在 header 里面才行,所以造成这个错误的发生 我们修改程序为 <? echo "testing ... "; session_start(); ?> 同样错误,因为 echo 已经输出了 我们修改程序为 <? $i=1; session_start(); ?> 运行准确表明在session_start的前面可以有计算语句,但是不能有输出语句 我尝试过修改 session.use_cookies = 0 ; whether to use cookies 但是没有成功,希望知道答案的朋友通知我,如何去掉cookie方法的 session 返回类别: 教程 上一教程: CGI安全漏洞资料速查 v1.0(转二) 下一教程: php & mysql三日通 2 您可以阅读与"关于使用 session_start 出现的 headers already sent错误的解释"相关的教程: · 抛开Cookie使用SESSION-PHP中SESSION不能跨页传递问题的解决办法 · 关于使用文本域(TextArea)的一个问题 · 抛开Cookie使用SESSION-PHP中SESSION不能跨页传递问题的解决办法 · 仅用PHP4 Session实现的迷你购物篮(一) · 关于session的几个补充函数 |
![]() ![]() |
快精灵印艺坊 版权所有 |
首页![]() ![]() ![]() ![]() ![]() ![]() ![]() |