当前位置:Gxlcms > PHP教程 > session_start();报错有关问题

session_start();报错有关问题

时间:2021-07-01 10:21:17 帮助过:19人阅读

session_start();报错问题
test.php文件内容
include('site_test.php');
?>

site_test.php文件内容
session_start();
header('Content-Type: text/html; charset=utf-8');
?>

当打开test.php时报以下错误,弄了很久也弄不明白,不知为什么?


Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/cybertry/public_html/idearforyou.com/site_test.php:1) in /home/cybertry/public_html/idearforyou.com/site_test.php on line 2

Warning: Cannot modify header information - headers already sent by (output started at /home/cybertry/public_html/idearforyou.com/site_test.php:1) in /home/cybertry/public_html/idearforyou.com/site_test.php on line 3
------解决方案--------------------
session_start();前面不能有输出
------解决方案--------------------
site_test.php 是什么编码,如果是utf-8编码,确认没有bom头。

人气教程排行