嗨,我只是不明白为什么我的代码不起作用。我正在为我的网站使用雅虎服务器。
这是我的注销代码。(在本地主机上成功运行)但是当我在线上传此代码时它不起作用。请帮助
<?php
//logout code
include("../Config.php");
if (!isset ($_SESSION['username']))
{
header( 'HTTP/1.1 301 Moved Permanently' );
header('Location: ../index.php');
if (!headers_sent())
{
header('Location: http://www.mysite.com/index.php');
exit;
}
}
else
{
$_SESSION = array();
session_destroy();
session_unset();
header( 'HTTP/1.1 301 Moved Permanently' );
header('Location: ../index.php');
if (!headers_sent())
{
header('Location: http://www.mysite.com/index.php');
exit;
}
}
?>
config.php 文件包含会话代码(如启动会话)