如何在php中销毁会话?PHP会话销毁
的事情是当用户点击退出按钮的会议将结束,他将被重定向到的index.php这里是我的代码
Customer.php
<?php
session_start();
#include("Connection.php");
if (isset($_POST['submit'])) {
$name = $_POST['customerName'];
$_SESSION['user'] = $name;
}
if (isset($_SESSION['user'])) { echo "Hello {$_SESSION['user']}, welcome back"; }
else{echo "walang tao";}
$sql="INSERT INTO ORDERS(Name) VALUES('$name')";
mysql_query($sql);
session_destroy();
?>
<button><a href="Customer.php"></a></button>
,这是从当用户想再次登录
<?PHP
/* this must go before any html */
session_start();
if (isset($_SESSION['user'])) {
header("location: Customer.php");
}
?>
<div class="sign">
<h2>Welcome</h2>
<form action = "Customer.php" method = "POST">
Customer Name:<input type = "text" name="customerName">
<input type = "submit" name = "submit">
</form>
用Customer.php替换index.php –
http://php.net/session_destroy – deceze
当你看到他时,向我问好'Bobby Tables'。 –