2015-12-19 61 views
1

我從笨默認會話陣列Codigniter會話陣列

Array ([__ci_last_regenerate] => 1450553587) 

需要SESSION_ID,IP等

我使用笨僅此獲得3

+1

你能告訴你如何設置會話? –

+0

我加載自動載入會話庫,並打印默認數組\t print_r($ this-> session-> all_userdata()); exit(); – Maneesh

+0

你需要添加一些代碼到你的session.php文件中,請檢查我的答案。 –

回答

0

笨3.0.x中不把(所有)會話元數據在$ _SESSION數組中。 以下是如何訪問未找到的項目。

echo "Session ID:".session_id()."<br>"; 
    echo "Remote Address: ".$_SERVER['REMOTE_ADDR']."<br>"; 
    echo "User Agent: ".$this->input->user_agent()."<br>"; 

而獲得上屆會議再生

echo "Last Regenerate: ".($_SESSION['__ci_last_regenerate']); 
0

你會在系統文件夾中的代碼這種平和添加到您的session.php文件。

$_SESSION['ip_address'] = $_SERVER['REMOTE_ADDR']; 

這個代碼和平session.php文件

添加到您的

Codeigniter_Project_path \系統\圖書館\會議

後:

session_start(); 

這將是結果:

array(2){[「__ci_last_r egenerate 「] => INT(1450542332)[」 IP_ADDRESS「] =>串(9) 」127.0.0.1「}

UPDATE

Check this

session_id: session_id() 
    ip_address: $_SERVER['REMOTE_ADDR'] 
    user_agent: $this->input->user_agent() (unused by sessions) 
    last_activity: Depends on the storage, no straightforward way. Sorry! 

這些特性必須被添加到session.php並生成新的會話。