setcookie() with Warning: Cannot mod. header. info. - headers already sent by (output started at...)
2013-01-17 15:52
239 查看
It is a simple stupid mistake, when I was digging on
setcookie() function, I got error ahead the HTML content:
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\write-cookies.php:1) in C:\xampp\htdocs\write-cookies.php on line 2
And my PHP code is:
According to the posts from the internet, the crux is the HTML output before the call to this function, but that is not my case:
http://www.webdeveloper.com/forum/showthread.php?74202-RESOLVED-quot-Cannot-modify-header-information-quot http://stackoverflow.com/questions/2658083/setcookie-cannot-modify-header-information-headers-already-sent
Finally, I found the reason here:
PHP setcookie() cannot modify header information 的解决方法
It is because of my incorrect setting on encode format of the file:
setcookie() function, I got error ahead the HTML content:
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\write-cookies.php:1) in C:\xampp\htdocs\write-cookies.php on line 2
And my PHP code is:
<?php setcookie("myvar", "99", 0, "/", "" 0); echo "<h1>blablablabla</h1>"; ?>
According to the posts from the internet, the crux is the HTML output before the call to this function, but that is not my case:
http://www.webdeveloper.com/forum/showthread.php?74202-RESOLVED-quot-Cannot-modify-header-information-quot http://stackoverflow.com/questions/2658083/setcookie-cannot-modify-header-information-headers-already-sent
Finally, I found the reason here:
PHP setcookie() cannot modify header information 的解决方法
It is because of my incorrect setting on encode format of the file:
相关文章推荐
- 关于报错:Warning: Cannot modify header information - headers already sent by (output started at
- dedecms出错此问题:Cannot_modify_header_information_-_headers_already_sent_by_(output_started_at
- php出错Warning: Cannot modify header information - headers already sent by (output started at
- Warning: Cannot modify header information - headers already sent by (output started at
- Warning: Cannot modify header information - headers already sent by (output started at
- Cannot modify header information - headers already sent by (output started at 问题
- PHP warning Cannot modify header information - headers already sent by (output started at...
- Warning: Cannot modify header information - headers already sent by (output started at c:/program files/easyphp1-8/www/wp-config
- Warning: Cannot modify header information - headers already sent by (output started at...
- Warning: Cannot modify header information - headers already sent by (output started at
- Warning: Cannot modify header information - headers already sent by (output started at
- Warning: Cannot modify header information - headers already sent by (output started at...
- PHP设置header出现警告headers already sent by (output started at......
- 安装wordpress出现:Warning: Cannot modify header information - headers already sent (output started at...)错误解决方案
- Cannot modify header information - headers already sent by (output started at D:\PHP\xampp\htdocs\
- Cannot modify header information - headers already sent by (output started at D:\softwares\wamp\wamp
- 警告:Warning: Cannot modify header information - headers already sent by (output started at E:\phpweb\
- setcookie中Cannot modify header information-headers already sent by错误的解决方法详解
- 解决Warning: Cannot modify header information - headers already sent by..
- Cannot modify header information - headers already sent by错误解决办法