网页重定向无法正常工作


Webpage redirect not working properly

我正在为我的网站制作index.php页面,在下面的代码第13行遇到了多个错误,但我已经修复了大部分错误。我试着添加

</meta>

甚至;之后http equiv="刷新"

这是我的代码:

<?php

session_start();

$username = $_SESSION['username'];
$password = $_SESSION['password'];
if(!$username && !$password){
echo "You will be redirected to login in 5 seconds! (<meta http-equiv="refresh"; content="5; URL=login.php"></meta>)";
}else{
echo "Welcome , ".$username."! (<a href=logout.php>Logout</a>)";
}

?>

问题是双引号中的双引号。。使用''或使用单引号转义它们。

echo "You will be redirected to login in 5 seconds! (<meta http-equiv='"refresh'"; content='"5; URL=login.php'">)";