三个等号代表比较对象的类型也要一致。两个等号表示只要值相等就满足条件。
Class 'SoapClient' not found
extension=php_soap.dll
function authenticate()
{
header('WWW-Authenticate: Basic realm=""');
header('HTTP/1.0 401 Unauthorized');
echo "You must enter a valid login ID and password to access this resource
";
exit;
}
if (addslashes($_SERVER['PHP_AUTH_USER'])!= 'adminname' || addslashes($_SERVER['PHP_AUTH_PW'])!= 'adminadmin')
{
header('WWW-Authenticate: Basic realm=""');
header('HTTP/1.0 401 Unauthorized');
echo "对不起,无权进入! user=".$_SERVER['PHP_AUTH_USER']."password=".$_SERVER['PHP_AUTH_PW']; //后面这半句我是为了测试而加上去的;
}
else
{
echo "进入! user=".$_SERVER['PHP_AUTH_USER']."password=".$_SERVER['PHP_AUTH_PW']; //后面这半句我是为了测试而加上去的;
echo "<p>Welcome: {$_SERVER['PHP_AUTH_USER']}<br />";
// echo "Old: {$_REQUEST['OldAuth']}";
// echo "<form action='' METHOD='post'>
";
// echo "<input type='hidden' name='SeenBefore' value='1' />
";
// echo "<input type='hidden' name='OldAuth' value='{$_SERVER['PHP_AUTH_USER']}' />
";
// echo "<input type='submit' value='Re authenticate' />
";
// echo "</form></p>
";
echo date('h:i:s') . "<br />";
//暂停 10 秒
sleep(10);
//重新开始
echo date('h:i:s');
header('WWW-Authenticate: Basic realm=""');
header('HTTP/1.0 401 Unauthorized');
}
//可以直接使用试试看是不是你想要的结果