Heim  >  Artikel  >  Backend-Entwicklung  >  网站测试文字显示乱码的有关问题

网站测试文字显示乱码的有关问题

WBOY
WBOYOriginal
2016-06-13 10:13:02883Durchsuche

网站测试文字显示乱码的问题
我的数据库的字符是GB2312_CHINESE_BIN
fun.php设置的字符是gb2312
除了纯PHP代码的页面,每个页面都改好了是gb2312
网页代码的文字显示没有问题,
但是纯PHP代码中,输出的表格中的文字就会显示乱码,怎么解决?

------解决方案--------------------
在php页面设置header("Content-type: text/html; charset=gbk"); php文件保存时选择编码也要选gbk吧
------解决方案--------------------
对,程序文件也要存成gbk。。。我遇到的问题是把什么都统一到utf8,但很多时候代码文件存储的不是utf8,就会出现乱码问题
------解决方案--------------------
恩。取数据时。加上mysql_query("set names 'gbk'");
------解决方案--------------------

探讨

引用:
在php页面设置header("Content-type: text/html; charset=gbk"); php文件保存时选择编码也要选gbk吧

header("Content-type: text/html; charset=gbk");
..?>

是这样加吗??

------解决方案--------------------
PHP code
<?php header("Content-type: text/html; charset=gbk"); ?><br><font color="#e78608">------解决方案--------------------</font><br>
探讨
但是纯PHP代码中,输出的表格中的文字就会显示乱码,怎么解决?

------解决方案--------------------
探讨
在php页面设置header("Content-type: text/html; charset=gbk"); php文件保存时选择编码也要选gbk吧
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn