Maison >développement back-end >tutoriel php >session_start();报错有关问题
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头。