且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Codeigniter会话在PHP 7上不起作用

更新时间:2023-10-17 17:45:10

最近,我通过将php版本从5.6升级到7.1遇到了同样的问题 我的开发环境是使用php7.1.4的XAMPP(Apache + MariaDB)

Recently I've faced the same problem by upgrading my php version from 5.6 to 7.1 My development environment is XAMPP (Apache + MariaDB) using php7.1.4

请按照以下步骤操作:

1)转到系统/库/Session/Session.php

1) Go to system/libraries/Session/Session.php

2)通过添加//注释session_start().

2) Comment session_start() by adding //.

3)下一行至312-315左右,其中说安全为王",并注释掉以下几行:

3) Go down to line around 312-315 where it says Security is king, and comment out the following lines:

ini_set('session.use_trans_sid', 0);
ini_set('session.use_strict_mode', 1);
ini_set('session.use_cookies', 1);
ini_set('session.use_only_cookies', 1);
ini_set('session.hash_function', 1);
ini_set('session.hash_bits_per_character', 4);

4)然后转到您的主index.php(根index.php)

4) Then go to your main index.php ( the root index.php )

5)在顶部一次添加session_start().

5) Add session_start() at the top once.

对我有用.