我不能夠取消設置在PHP中的會話(當我點擊退出應該destroy_session(),但它不工作我的代碼無法註銷(會話沒有被破壞掉了)在PHP
<ul class="nav1">
<?php
if(!isset($_SESSION['user_name']) && empty($_SESSION['user_name']))
{
echo '<li><a href="#" data-toggle="modal" data-target="#myModal">Mobile</a></li>';
echo '<li><a href="#" data-toggle="modal" data-target="#myModal2">datacard</a></li>';
echo '<li><a href="#" data-toggle="modal" data-target="#myModal1">DTH</a></li> ';
echo '<li><a href="#" data-toggle="modal" data-target="#myModal4">login</a></li>';
echo '<li><a href="#" data-toggle="modal" data-target="#myModal5">Signup</a></li>';
}
else
{
echo "<li><a href='#'>Hello,".$_SESSION['user_name']."</a></li>";
echo "<li><a href='orders.php'>Passbook</a></li>";
echo "<li><a href='#'>Wallet</a></li>";
echo "<li><a href='settings.php'>Settings</a></li>";
echo "<li><a href='logout.php'><i class='fa fa-sign-out'></i> Logout</a></li>";
}
?>
我的註銷代碼
<?php ob_start();
session_destroy();
unset($_SESSION['user_name']);
header("Location: index.php");
exit();
?>
請幫我!臨屋提前
是它的工作!謝謝 –