I wrote a login page using ci, the code is as follows:
print_r($this->session->userdata());
$this->session->set_userdata('test',rand(564,489426354465));
echo '<br>';
print_r($this->session->userdata());
Output:
Array ( [__ci_last_regenerate] => 1497598658 )
Array ( [__ci_last_regenerate] => 1497598658 [test] => 115826667932 )
No matter how many times the page is refreshed, the value of test
does not exist in the session, but the timestamp of __ci_last_regenerate
has increased. Why is this? Has anyone encountered this situation?
Check 1, it is not a php configuration problem. I created a php file in the root directory. The code is as follows. The correct session can be output every time
session_start();
ob_start();
print_r($_SESSION);
$_SESSION['test'] = rand(456,4984945569);
print_r($_SESSION);
大家讲道理2017-06-17 09:17:22
The original ci version was 3.1.0 (a constant defined in /system/core/CodeIgniter.php). Later, it was overwritten with all the files in the system
of 3.1.3, and the problem was solved. This is considered 3.1. 0 bugs?
I used php5.5 before, but changed it to php7.1.4 a few days ago. I don’t know if this is the reason