问题描述
我已经在codeigniter中开发了一个网站,并为博客集成了wordpress。我的问题是,如果我登录该站点,则无法在wordpress博客中使用codeigniter会话值。
I have developed a website in codeigniter and integrated wordpress for blog. My problem is if i logged in the site, i am not able to use the codeigniter session value in the wordpress blog.
在登录后,在Codeigniter中设置
In Codeigniter once i logged in i am setting the following session using codeigniter session.
$this->session->set_userdata('get_user_session', $auD);
现在我需要在wordpress头文件或索引文件中使用会话。我在wordpress中尝试了以下代码。
Now i need to use the session in wordpress header file or index file. I tried the below code in wordpress.
session_start();
print_r($_SESSION);
我没有获得上述ci会话值。
I am not getting the above ci session values.
推荐答案
CodeIgniter的:
CodeIgniter's Session class:
>>将每个用户的会话信息存储为Cookie中的序列化(以及可选的加密)数据
。
您使用 $ this-> session-&set; set_userdata('key','value')不会出现在
$ _ SESSION
变量中。
The values you set using
$this->session->set_userdata('key','value')
are not going to be present in the $_SESSION
variable.
CodeIgniter还支持将会话内容存储在数据库。
CodeIgniter also supports storing session content in a database.
您可以使用该配置在WordPress博客中检索会话数据。
You can use that configuration to retrieve the session data in your WordPress blog.
这篇关于Wordpress中的Codeigniter会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!