如果您想要一个新的,请session_destroy()在开始之前进行操作。要在启动之前检查其设置,请致电session_status():$status = session_status();if($status == PHP_SESSION_NONE){ //There is no active session session_start();}elseif($status == PHP_SESSION_DISABLED){ //Sessions are not available}elseif($status == PHP_SESSION_ACTIVE){ //Destroy current and start new one session_destroy(); session_start();}我会避免检查全局$_SESSION,而不是的 ,我呼吁的session_status()方法,因为PHP明确实现此功能:通过新函数session_status公开会话状态这是针对(PHP> = 5.4.0)