header('Content-type:text/html;charset=utf-8');
header("WWW-Authenticate: Basic realm='你好'");
header('HTTP/1.0 401 Unauthorized');
PHP中通过设置header("WWW-Authenticate: Basic realm='你好'");,实现basic认证
但是realm的提示信息输入中文时,就显示乱码。通过header设置utf-8,gbk都不行。不知道该如何处理?
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
火狐浏览器basic_auth好像不支持中文。 chrome可以
尝试将提示信息转成ISO-8859-1编码