[英]header of php not redirecting to mention page
我正在使用 php 的 header 函数重定向到索引页,但是在重定向后,出现一个错误,表明您没有连接到网络。
两个文件都在同一个目录下。
代码是
function chklogin()
{
require('script/session.php');
if(isset($usernmae))
{
echo "welcome";
}
else
{
header('location: index.php');
}
}
header('location: index.php');
请将您的代码更改为此,然后尝试:)
function chklogin()
{
require('script/session.php');
if(isset($username))
{
echo "welcome ".$username;
}
else
{
header('Location: /index.php');
}
}
chklogin();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.