dpbfb7119 2017-03-13 05:52
浏览 52

会话变量在其他控制器中不起作用(CodeIgniter)

I set a session variable in my login controller after successful login. When I check for the variable in my dashboard controller no session data is found.

When I check the session in the login controller, session data exists. It does not exist when I check the dashboard controller. I have also tried using database sessions with no success.

I am using CodeIgniter 3.1.3 with HMVC (Module Based MX Controller). Code and screenshots of my current issue follow.

My Config File for Session

$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = APPPATH . 'cache/';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

Attachment 1

enter image description here

Attachment 2

enter image description here

Attachment 3

enter image description here

Attachment 4

Blockquote

enter image description here

  • 写回答

3条回答 默认 最新

  • dsy19890123 2017-03-13 05:58
    关注

    print_r($_SESSION) doesn't works in CI. In Codeigniter we have to write following syntax.

    print_r($this->session->userdata); 
    

    or

    print_r($this->session->all_userdata());
    
    评论

报告相同问题?

悬赏问题

  • ¥15 求解答一道线性规划题,用lingo编程运行,第一问要求写出数学模型和lingo语言编程模型,第二问第三问解答就行,我的ddl要到了谁来求了
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果