天啊!为什么别人都能用,我的session有问题呀!!!!

kitling kitling 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
编写了两个文件,用session传值:

----temp1.php-----
<?php
session_start()
?>
<html>
<body>
<?php
$a="abc";
session_register("a");

?>
<a href=temp2.php > --cc-- </a>
</body>
</html>

----temp2.php-----
<?php
session_start()
?>
<html>
<body>
<?php
echo $_SESSION["a"];
?>
</body>
</html>

执行temp1.php后显示:

Warning: session_start(): open(/tmp\sess_c27bb8cff68fa6a3bf4a437561c8866b, O_RDWR) failed: No such file or directory (2) in D:\Work\php\temp1.php on line 2

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at D:\Work\php\temp1.php:2) in D:\Work\php\temp1.php on line 2

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at D:\Work\php\temp1.php:2) in D:\Work\php\temp1.php on line 2
--cc--
Warning: Unknown(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0

把php.ini改为

session.save_path = c:\temp or session.save_path = c:\

错误照常!!

又改为:

session.save_path = /tmp/ or session.save_path = /tmp

还是一样?????(c:\temp c:\tmp c:\php\temp c:\php\tmp都有)

去c:\tmp中查看,发现有sess_c27bb8cff68fa6a3bf4a437561c8866b这个文件,文件内容如下:

a|s:3:"abc";

但就是出错!!!谁知道我有哪个低级错误呀!!!快告诉我吧!!!谢谢了。
...全文

相关推荐

评论 12
收藏 已收藏
分享
返回顶部
kitling
基础编程 21,889 成员 140,329 内容