http_auth_php 内容
<?php
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="imge grade system."');
header('HTTP/1.0 401 Unauthorized');
exit;
}
else {
$user = $_SERVER['PHP_AUTH_USER'];
$passwd = $_SERVER['PHP_AUTH_PW'];
if ($user == "test" and $passwd == "1010") {
header("Location: ./test.php");
}
else {
header('WWW-Authenticate: Basic realm="imge grade system."');
header('HTTP/1.0 401 Unauthorized');
exit;
}
}
?>test.php 内容
<?php
require_once("http_auth.php");
echo "hello php";
?>index.php 内容
<?php
require_once("http_auth.php");
?>在火狐浏览器中访问主页,输入账号和密码后,提示错误:
此页面不能正确地重定向
Firefox 检测到该服务器正在将此地址的请求循环重定向。
此问题可能是因为禁用或拒绝 Cookie 导致。
怎么解决这个问题,我是一个新手,请各位大虾说的详细些,最好附示例代码,谢谢。
<?php
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="imge grade system."');
header('HTTP/1.0 401 Unauthorized');
exit;
}
else {
$user = $_SERVER['PHP_AUTH_USER'];
$passwd = $_SERVER['PHP_AUTH_PW'];
if ($user == "test" and $passwd == "1010") {
header("Location: ./test.php");
}
else {
header('WWW-Authenticate: Basic realm="imge grade system."');
header('HTTP/1.0 401 Unauthorized');
exit;
}
}
?>test.php 内容
<?php
require_once("http_auth.php");
echo "hello php";
?>index.php 内容
<?php
require_once("http_auth.php");
?>在火狐浏览器中访问主页,输入账号和密码后,提示错误:
此页面不能正确地重定向
Firefox 检测到该服务器正在将此地址的请求循环重定向。
此问题可能是因为禁用或拒绝 Cookie 导致。
怎么解决这个问题,我是一个新手,请各位大虾说的详细些,最好附示例代码,谢谢。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货