我尝试创建一个可用于PHP页面的会话。
但它没有用。
Test1.php
session_start();
$_SESSION["current_id"] = 7 ;
echo "Current id : " . $_SESSION['current_id'] . "</br>" ;
if (!is_writable(session_save_path())) {
echo 'Session path "' . session_save_path() . '" is not writable for PHP!'; }
else {
echo 'Session path "' . session_save_path() . '" is Writable for PHP!'; }
echo("</br>");
var_dump($_SESSION);
结果:
当前身份证号码:7
会话路径“/ var / lib / php5”可写为PHP! /home/ubuntu/workspace/CRF/main1.php:58:array(1) {'current_id'=&gt; string(1)“7”}
Tets2.php
session_start();
echo "Current id : " . $_SESSION['current_id'] . "</br>" ;
echo("</br>");
var_dump($_SESSION);
结果:
当前ID:/home/ubuntu/workspace/CRF/workflow.php:108:array(0){}
任何想法?