<code>header('Content-type:text/html;charset=utf-8');header("WWW-Authenticate: Basic realm='你好'");header('HTTP/1.0 401 Unauthorized');</code>
PHP中通过设置header(“WWW-Authenticate: Basic realm=’你好'”);,实现basic认证
但是realm的提示信息输入中文时,就显示乱码。通过header设置utf-8,gbk都不行。不知道该如何处理?
回复内容:
<code>header('Content-type:text/html;charset=utf-8');header("WWW-Authenticate: Basic realm='你好'");header('HTTP/1.0 401 Unauthorized');</code>
PHP中通过设置header(“WWW-Authenticate: Basic realm=’你好'”);,实现basic认证
但是realm的提示信息输入中文时,就显示乱码。通过header设置utf-8,gbk都不行。不知道该如何处理?
运行你那段代码直接提示这个,是不是你的浏览器编码
没设置?
火狐浏览器basic_auth好像不支持中文。 chrome可以
][1]
realm=’你好’在弹出的框中是乱码,浏览器firefox和chrome都一样,编码我都设置过了,U
)本文来源gaodai.ma#com搞#代!码网_
搞代gaodaima码TF-8,GBK都不行。
尝试将提示信息转成ISO-8859-1编码