我用的是dreamweaver,開一個新網頁,取名為logout.php。
伺服器行為->使用者驗證->登出使用者
網頁語法如下
<?php
// *** Logout the current user.
$logoutGoTo = "dfdfdf.php";
if (!isset($_SESSION)) {
session_start();
}
$_SESSION['MM_Username'] = NULL;
$_SESSION['MM_UserGroup'] = NULL;
unset($_SESSION['MM_Username']);
unset($_SESSION['MM_UserGroup']);
if ($logoutGoTo != "") {
header("Location: $logoutGoTo"); //這一行我加以修改
exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文件</title>
</head>
<body>
</body>
</html>
============分隔線========================
<?php
// *** Logout the current user.
$logoutGoTo = "dfdfdf.php";
if (!isset($_SESSION)) {
session_start();
}
$_SESSION['MM_Username'] = NULL;
$_SESSION['MM_UserGroup'] = NULL;
unset($_SESSION['MM_Username']);
unset($_SESSION['MM_UserGroup']);
if ($logoutGoTo != "") {
echo "</script>windows.location.href='logoutGoTo'</script>" // 我換成這一行
exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文件</title>
</head>
<body>
</body>
</html>
第一個語法對伺服器負擔大,
第二個語法是對瀏覽網站的網友電腦負擔相對大,
是嗎?
請問一下這兩個程式語法差在哪?