CodeIgniter会话 [英] CodeIgniter Session
问题描述
我尝试使用第三方脚本并解压登录的用户userid。我知道CodeIgniter使用某种加密会话。你能否建议如何获取用户ID。一个简单的$ _SESSION似乎不工作。
我基本上运行一个单独的脚本,我只想要会话细节,即用户ID。但我不想修改这个脚本作为MVC模型。我想修改它尽可能最小。
对不起,我是CodeIgniter的新手。感谢您的时间。
取决于您是否自动加载会话库,我们需要包括: / p>
$ this-> load-> library('session');
那么你应该能够使用:
$ session_id = $ this-> session-> userdata('SessionID');这是否能满足您的需要? I am trying to use a third party script and extract the logged in users userid. I am aware the CodeIgniter uses some sort of encrypted sessions. Can you please suggest how to get the userid. A simple $_SESSION does not seem to work.
I am basically running a separate script and i just want the session details i.e. the userid. But I do not want to modify this script as MVC model. I want to modify it as minimal as possible.
Sorry I am very new to CodeIgniter. Thank you for your time.
解决方案 Depending if you auto-load the session library or not, we will need to include:
$this->load->library('session');
Then you should be able to use:
$session_id = $this->session->userdata('SessionID');
Does this get you what you need?
这篇关于CodeIgniter会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!