程序用的是Notepad++文本编辑器编写的,当选择格式->以UTF-8格式编码后,中文字符(从数据库读取,存储到$_SESSION中)可以正常显示,但是会出现以下警告
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at E:\wamp\www\biyesheji\login_check.php:1) in E:\wamp\www\biyesheji\login_check.php on line 1
Warning: Cannot modify header information - headers already sent by (output started at E:\wamp\www\biyesheji\login_check.php:1) in E:\wamp\www\biyesheji\login_check.php
Array ( [username] => 张三 [userid] => 2009011105 [role] => 3 )
登录成功!
5秒钟后进行跳转
去掉BOM头后,警告消失,但是中文字符全部变成乱码
Array ( [username] => 寮?? [userid] => 2009011105 [role] => 3 )
?诲????!
5绉?????琛?烦杞
求解决方法
header('Content-type: text/html; charset=utf-8');
PHP code?1header('Content-type: text/html; charset=utf-8');加一句申明是UTF-8编码,不然浏览器可能会自己去检测
解决了,多谢