Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在 PHP 中获取经过 HTTP 认证的用户名?
这是您正在寻找的答案:
$username = $_SERVER['PHP_AUTH_USER']; $password = $_SERVER['PHP_AUTH_PW'];
$_SERVER['REMOTE_USER']如果 PHP 作为 Apache 模块运行,并且其他任何东西都非常棘手
$_SERVER['REMOTE_USER']
顺便说一句,phpinfo()经常帮助解决这些问题
phpinfo()