我是學習Php的新手。我創建了以下代碼。PHP會話破壞後存在
<?php
/*
* Testing Sessions with PHP
*/
session_start();
$_SESSION['user_id'] = 'Testing User';
session_destroy();
?>
<html>
<head>
<title> Sessions Page</title>
</head>
<body>
<?php
echo $_SESSION['user_id'];
?>
</body>
</html>
現在回聲$ _SESSION [ 'user_ID的']回聲測試用戶。在我看來,它不應該,因爲我已經破壞了會議。是什麼原因?
太棒了!它的工作,但session_unset()和session_destroy()之間有什麼區別? –
@back http://stackoverflow.com/questions/4303311/what-is-the-difference-between-session-unset-and-session-destroy-in-php – NullUserException
這個問題依然存在於我的腦海裏。當會話被破壞時爲什麼會話變量存在。至少對我而言,這並沒有連接到邏輯。請詳細說明您是否可以。 –