Home > Backend Development > PHP Tutorial > 关于HTTP BASIC权限认证解决方案

关于HTTP BASIC权限认证解决方案

WBOY
Release: 2016-06-13 12:21:08
Original
1084 people have browsed it

关于HTTP BASIC权限认证
最近在连公司的运营支撑平台,系统是JAVA的,接口连接时要做身份验证,基于HTTP  BASIC权限认证。
要输入用户名和密码,我百度了下,没找到这方面的资料,请问下,php怎么做Basic权限证证呀。。。
------解决思路----------------------
手册中有:
例子 34-1. Basic HTTP 认证范例

<?php<br />  if (!isset($_SERVER['PHP_AUTH_USER'])) {<br />    header('WWW-Authenticate: Basic realm="My Realm"');<br />    header('HTTP/1.0 401 Unauthorized');<br />    echo 'Text to send if user hits Cancel button';<br />    exit;<br />  } else {<br />    echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";<br />    echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</p>";<br />  }<br />?>  <br />
Copy after login

------解决思路----------------------
估计在服务器上对你要访问的路径限制访问可以实现你的要求

Related labels:
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template