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

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

WBOY
Release: 2016-06-13 09:55:26
Original
1127 people have browsed it

在使用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的。然后再去关闭

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template