程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> PHP編程 >> PHP基礎知識 >> PHP出現 Warning: session

PHP出現 Warning: session

編輯:PHP基礎知識
 

我的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

 
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved