| 129行目: | 129行目: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<br> | <br> | ||
次に、<code>session_destroy</code>関数を使用して、セッションに登録された値を全て破棄する。<br> | |||
bool session_destroy(void) | bool session_destroy(void) | ||
| 139行目: | 139行目: | ||
成功した場合はtrue、失敗した場合はfalseを返す。 | 成功した場合はtrue、失敗した場合はfalseを返す。 | ||
<br> | <br> | ||
以下の例では、Sample1.phpのログアウトのリンクを選択して、Sample2.phpでセッションとクッキーを削除している。<br> | |||
次に、Sample3.phpでセッションとクッキーが正常に削除されているかを確認している。<br> | |||
<syntaxhighlight lang="php"> | <syntaxhighlight lang="php"> | ||
// Sample1.php | // Sample1.php | ||
| 172行目: | 174行目: | ||
?> | ?> | ||
<p><a href="./ | <p><a href="./Sample2.php">ログアウトする</a></p> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<br> | <br> | ||
| 200行目: | 202行目: | ||
session_destroy(); | session_destroy(); | ||
print('<p>ログアウトしました</p>'); | |||
?> | ?> | ||