关于php中用session_destroy不起作用的问题

       今天在做PHP session测试的过程中发现直接使用session_destroy()函数没有效果。google了下,发现很多朋友都遇到这个问题,有的朋友说在session_destroy()前要加上session_start(),经过测试还是不行,最后发现还要加上session_unset()才行。因此如果采用session_destroy()来注销所有的session,语句如下:

session_start();    //这句去掉也行,具体跟php.ini中的配置有关
session_unset();
session_destroy();

原文地址:https://www.cnblogs.com/Never/p/1371678.html