您好,欢迎访问一九零五行业门户网

PHP去除BOM头后出现乱码

程序用的是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');
加一句申明是utf-8编码,不然浏览器可能会自己去检测
php code?1header('content-type: text/html; charset=utf-8');加一句申明是utf-8编码,不然浏览器可能会自己去检测
解决了,多谢
其它类似信息

推荐信息