【发布时间】:2014-02-04 09:20:52
【问题描述】:
真的不知道下一步该做什么。可以说,我有
header.php
<?php
setcookie("the_cookie","data",time()+60);
?>
//followed by HTML codes
index.htm
<!--#include file="header.php"-->
<html>
//standard html stuff here
</html>
当我在我的任何 html 文件中包含 header.php 时,它无法设置 cookie。尽管
<!--#include file="header.php"-->
它是我的 html 文档的第一行,而 setcookie 是 header.php 的第一行 Apache 服务器启用了 SSI。因此,我确信 #include 可以正常工作,因为在 setcookie() 函数之后还有其他 HTML 代码,并且它显示正确。
但是当我自己运行 header.php 时,cookie 设置正确。这里有没有人遇到过这种情况并且知道需要做什么?
谢谢你
加里·乔
【问题讨论】: