Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php sess\u过期\u打开\u关闭选定用户Codeigniter上的数据_Php_Codeigniter_Session_Session Timeout - Fatal编程技术网

Php sess\u过期\u打开\u关闭选定用户Codeigniter上的数据

Php sess\u过期\u打开\u关闭选定用户Codeigniter上的数据,php,codeigniter,session,session-timeout,Php,Codeigniter,Session,Session Timeout,我只需要在某些会话上设置“sess\u expire\u on\u close”功能。 我不想在config.php进行编辑,以便在关闭浏览器时擦除所有会话 我需要像。。。 在我的配置文件中: $config['sess_expire_on_close'] = FALSE; 当我需要创建会话时,CI是否有类似的方法 $this->session->set_userdata('temporary','sample data',TRUE); 我也一直在读这个问题,我们有没有更

我只需要在某些会话上设置“sess\u expire\u on\u close”功能。 我不想在config.php进行编辑,以便在关闭浏览器时擦除所有会话

我需要像。。。 在我的配置文件中:

    $config['sess_expire_on_close'] = FALSE;
当我需要创建会话时,CI是否有类似的方法

$this->session->set_userdata('temporary','sample data',TRUE);
我也一直在读这个问题,我们有没有更可靠或基于CI的函数答案?而不是写我们自己喜欢的链接


谢谢。

如果您想将
$config['sess\u expire\u on\u close']=FALSE在运行时

if(!$remeber)
{
   $this->session->sess_expire_on_close = TRUE;
}
else
{
   $this->session->sess_expiration = 60*60*24*31;
   $this->session->sess_expire_on_close = FALSE;
}

这是一个很好的阅读

我在我的控制器上运行代码,但当我关闭并重新打开浏览器时,会话“状态”仍然存在
public function test(){
$this->config->item('sess\u expire\u on\u close',TRUE);
$this->session->set\u userdata('status','testing123');
}
try
echo$this->config->item('sess\u expire on\u close')
查看设置的内容,然后尝试将其设置为
TRUE
I set
$this->config->set\u项('sess\u expire\u on\u close',TRUE)
var\u dump($this->config->item('sess\u expire\u on\u close')结果是
bool(true)
但当我关闭并重新打开时,用户数据仍然保留…:( !