天啊!为什么别人都能用,我的session有问题呀!!!!
编写了两个文件,用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";
但就是出错!!!谁知道我有哪个低级错误呀!!!快告诉我吧!!!谢谢了。