当前位置:首页 > PHP教程 > PHP基础知识

如何在PHP中进行身份认证

<?
if(!isset($php_auth_user))
{
header("www-authenticate: basic realm=请输入你的用户名和密码:");
header("http/1.0 401 unauthorized");
echo "验证失败,你不能网络资源!";
exit;
}
else
{
if ($php_auth_user!="username" or $php_auth_pw!="password")
{
header("http/1.0 401 unauthorized");
echo "验证失败,你不能网络资源!";
exit;
}
}

?>

【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!