Home > php教程 > php手册 > 如何在PHP中进行身份认证

如何在PHP中进行身份认证

WBOY
Release: 2016-06-13 12:38:03
Original
1125 people have browsed it


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;
}
}

?>

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template