我的php出現 session問題當我編輯一個名字為session.php的程序其內容 " S+ C% e. O! p5 ^5 V
是
<?php
session_start();
$_SESSION[test]="test";
echo $_SESSION[test];
echo "<a href="/222.php">222.php</a>";
?>
但當我在浏覽器裡浏覽時出現
Warning: session_start() [function.session-start]: open(/tmp\sess_84cb589ea249708b09c3d5e6836fdd0d, O_RDWR) failed: No such file or directory (2) in E:\web\htdocs\111.php on line 9
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at E:\web\htdocs\111.php:8) in E:\web\htdocs\111.php on line 9
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at E:\web\htdocs\111.php:8) in E:\web\htdocs\111.php on line 9
test222.php
Warning: Unknown(): open(/tmp\sess_84cb589ea249708b09c3d5e6836fdd0d, O_RDWR) failed: No such file or directory (2) in Unknown on line 0
Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0
這個是session的tmp路徑沒有設置的緣故
你在php,ini的session.save_path設置一個路徑就可以了,並且這個路徑是有效的。比如:c:\winnt\temp
然後到你的c盤下面建一個目錄winnt,再在這個目錄下面建一個temp目錄(如果是在服務器就建在服務器)
最後重啟一下apache