简体   繁体   English

CodeIgniter:无法设置用户数据

[英]CodeIgniter: Cannot set_userdata

My codeigniter app is a subdomain of wordpress site. 我的codeigniter应用程序是wordpress网站的子域。

When I set a session, it's not working. 当我设置会话时,它不起作用。

I already autoloaded the session library and trace other possible problems. 我已经自动加载了会话库并跟踪其他可能的问题。

The problem is that $this->session->set_userdata() seems to not work. 问题是$this->session->set_userdata()似乎不起作用。

Try changing your cookie config as follows and see if it works: 尝试按以下步骤更改您的cookie配置,然后查看是否可行:

$config['cookie_domain']    = '.yourdomain.com';
$config['cookie_path']      = '/crm';

If it still doesn't work you can try configuring CI to save the session data in the database instead of disk. 如果仍然不起作用,则可以尝试配置CI,以将会话数据保存在数据库中而不是磁盘中。

Also make sure your $config['base_url'] is set to http://yourdomain.com/crm/ 还要确保将$ config ['base_url']设置为http://yourdomain.com/crm/

You should also have an .htaccess in your crm directory and it should contain below lines: 您的crm目录中还应该有一个.htaccess,并且应包含以下几行:

RewriteEngine on
RewriteBase /crm/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM