下面的一个是我的PHP网站中的链接..点击此按钮后,用户的会话应该被终止,他应该被重定向到主页..我已经写了这个概念的编码如下,但它只显示我空白页面(它没有重定向到主页)..请更正我的编码
<a href="Logout.php">
click here to log out</a>
Run Code Online (Sandbox Code Playgroud)
Logout.php中的编码如下
<?
session_start();
session_unset();
session_destroy();
ob_start();
header("location:home.php");
ob_end_flush();
include 'home.php';
//include 'home.php';
exit();
?>
Run Code Online (Sandbox Code Playgroud)
dee*_*ell 57
只有这一点是必要的
session_start();
unset($_SESSION["nome"]); // where $_SESSION["nome"] is your own variable. if you do not have one use only this as follow **session_unset();**
header("Location: home.php");
Run Code Online (Sandbox Code Playgroud)
Poe*_*rin 19
请改用:
<?
session_start();
session_unset();
session_destroy();
header("location:home.php");
exit();
?>
Run Code Online (Sandbox Code Playgroud)
<?php
session_start();
session_destroy();
header("Location: home.php");
?>
Run Code Online (Sandbox Code Playgroud)