HTTP身份验证(弹框验证)
<?php if($_SERVER['PHP_AUTH_USER'] != 'user' || $_SERVER['PHP_AUTH_PW'] != 'pass') { //会在服务器提示中显示提示 header("WWW-Authenticate:Basic realm="input you name and pwd""); header("HTTP/1.0 401 Unauthorized"); echo $_SERVER['PHP_AUTH_USER']."<br>"; echo "你取消登陆了<br>"; exit; } else { echo "<h1>Here it is!</h1>"; echo "<p>I bet you are glad you can see this secret page.</p>"; } ?>