PHP会话设置为变量并取消设置。
只是一个简单的问题 我尝试将会话存储到变量中,然后在第二行中尝试取消设置会话。在我的变量变为空之后PHP会话设置为变量并取消设置。,php,session,cakephp,Php,Session,Cakephp,只是一个简单的问题 我尝试将会话存储到变量中,然后在第二行中尝试取消设置会话。在我的变量变为空之后 //Assuming session Hello has a value already $hello_world = $this->Session->read('Hello'); $this->Session->delete('Hello'); print_r($hello_world); //empty here where it shouldn't ... 您正
//Assuming session Hello has a value already
$hello_world = $this->Session->read('Hello');
$this->Session->delete('Hello');
print_r($hello_world); //empty here where it shouldn't ...
您正在使用删除会话变量
$this->Session->delete('Hello');
因此,名为
Hello
的会话变量将从会话中删除。请参见此尝试回显该变量,因为它不是数组。如果不起作用,那么你必须发布你的整个视图。我想,他想知道“为什么$hello\u world是空的”,而不是如何取消会话变量。啊,我的错误,重定向到404时,我以为会话已经结束了。我真傻。