Maison > Article > développement back-end > PHP实现基本认证
PHP实现基本认证
<code><span><?php </span><span>if</span> (!<span>isset</span>(<span>$_SERVER</span>[<span>'PHP_AUTH_USER'</span>])) { header(<span>'HTTP/1.1 401 Unauthorized'</span>); header(<span>'WWW-Authenticate: basic realm="Input username and password"'</span>); <span>exit</span>; } <span>else</span> { <span>echo</span><span>'Your name is '</span> . <span>$_SERVER</span>[<span>'PHP_AUTH_USER'</span>]; <span>echo</span><span>'<br>'</span>; <span>echo</span><span>'Your password is'</span> . <span>$_SERVER</span>[<span>'PHP_AUTH_PW'</span>]; }</span></code>').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });
以上就介绍了PHP实现基本认证,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。