PHP:无法发送会话 cookie 错误 [英] PHP: Cannot send session cookie error
问题描述
我正在尝试建立一个会话,但我收到一个标头错误,尽管据我所知,我告诉它在发送标头之前启动会话.这里的任何帮助都会很有用.
Im trying to set up a session and i am getting a header error, dispite as far as i can tell i am telling it to start the session before the header is sent. any help here would be useful.
<?php
ob_start();
session_start();
$_SESSION['active'] = 1;
ob_end_flush();
?>
<html>
<body>
2009c Christ Redeemer Catholic Church
</body>
</html>
警告:session_start() [function.session-start]:无法发送会话 cookie - 头已经发送(输出开始于/home/content/k/u/r/kuriomister/html/temp/church/index.html)php:1) 在/home/content/k/u/r/kuriomister/html/temp/church/index.php 第 3 行
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/content/k/u/r/kuriomister/html/temp/church/index.php:1) in /home/content/k/u/r/kuriomister/html/temp/church/index.php on line 3
警告:session_start() [function.session-start]:无法发送会话缓存限制器 - 已发送标头(输出开始于/home/content/k/u/r/kuriomister/html/temp/church/index.html)php:1) 在/home/content/k/u/r/kuriomister/html/temp/church/index.php 第 3 行
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/k/u/r/kuriomister/html/temp/church/index.php:1) in /home/content/k/u/r/kuriomister/html/temp/church/index.php on line 3
推荐答案
如果您使用 UTF-8,请确保保存文件时不带 物料清单.
If you use UTF-8, be sure to save the file without BOM.
这篇关于PHP:无法发送会话 cookie 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!