Home > Backend Development > PHP Tutorial > session_start();报错有关问题

session_start();报错有关问题

WBOY
Release: 2016-06-13 11:50:27
Original
1513 people have browsed it

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头。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template