错误 - php提示「headers already sent by」是怎么回事?
SAE_Warning: Cannot modify header information - headers already sent by (output started at /data1/www/htdocs/345/leank/1/bbs/login.php:15) in bbs/login.php on line 9
SAE_Warning: Cannot modify header information - headers already sent by (output started at /data1/www/htdocs/345/leank/1/bbs/login.php:15) in bbs/login.php on line 10
SAE_Warning: Cannot modify header information - headers already sent by (output started at /data1/www/htdocs/345/leank/1/bbs/login.php:15) in bbs/login.php on line 28
SAE_Warning: Cannot modify header information - headers already sent by (output started at /data1/www/htdocs/345/leank/1/bbs/login.php:15) in bbs/login.php on line 29
大致的代码:
"; } else { echo "登录失败!"; echo "请检查您的用户名或密码是否都填写正确"; } } else { echo "登录失败!"; echo "请检查您的用户名或密码是否为空"; } } ?>
处错误的大致是这个位置:
setcookie('username','$username',time()+31536000,'/');
setcookie('logset','ok',time()+31536000,'/');
回复内容:
错误提示:
SAE_Warning: Cannot modify header information - headers already sent by (output started at /data1/www/htdocs/345/leank/1/bbs/login.php:15) in bbs/login.php on line 9
SAE_Warning: Cannot modify header information - headers already sent by (output started at /data1/www/htdocs/345/leank/1/bbs/login.php:15) in bbs/login.php on line 10
SAE_Warning: Cannot modify header information - headers already sent by (output started at /data1/www/htdocs/345/leank/1/bbs/login.php:15) in bbs/login.php on line 28
SAE_Warning: Cannot modify header information - headers already sent by (output started at /data1/www/htdocs/345/leank/1/bbs/login.php:15) in bbs/login.php on line 29
大致的代码:
"; } else { echo "登录失败!"; echo "请检查您的用户名或密码是否都填写正确"; } } else { echo "登录失败!"; echo "请检查您的用户名或密码是否为空"; } } ?>
处错误的大致是这个位置:
setcookie('username','$username',time()+31536000,'/');
setcookie('logset','ok',time()+31536000,'/');
因为在setCookie之前多输出了东西造成的,看代码似乎是输出了空格,把中间的
?>去掉应该就可以了
亲爱的.记得每次写完程序后把文件保存成UTF-8 无BOM格式哦.否则就容易出现这样的错误的说~
推荐阅读
-
错误 - php提示「headers already sent by」是怎么回事?
-
php session_start()关于Cannot send session cache limiter - headers already sent错误解决方法
-
PHP提示Cannot modify header information - headers already sent by解决方法
-
PHP错误Warning: Cannot modify header information - headers already sent by解决方法
-
php session_start()关于Cannot send session cache limiter - headers already sent错误解决方法
-
setcookie中Cannot modify header information-headers already sent by错误的解决方法详解_php技巧
-
setcookie中Cannot modify header information-headers already sent by错误的解决方法详解_php技巧
-
PHP错误Warning: Cannot modify header information - headers already sent by解决方法
-
PHP错误Warning: Cannot modify header information - headers already sent by解决方法_php实例
-
php session_start()关于Cannot send session cache limiter - headers already sent错误解决方法_php技巧