Home >php教程 >php手册 >Warning: session_destroy() [function.session-destroy]: Tryin

Warning: session_destroy() [function.session-destroy]: Tryin

WBOY
WBOYOriginal
2016-06-13 09:55:261125browse

在使用session_destroy(),进行Session变量的注销时,出现了

Warning: session_destroy() [function.session-destroy]: Trying to destroy
uninitialized session in

的错误!!经查证,在进行使用session_destroy()函数必须先调用session_start()函数。
也就是要有如下代码:

session_start();
session_destroy();
?>

分析

还是经验不足啊,对session的理解不足。出现了这个错误,后来查了一下,

在调用session_destroy()之前,需要调用 session_start();

来告诉系统你当前是有session的。然后再去关闭

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn