首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > PHP >

帝国CMS php展示乱码 求指教-

2012-08-14 
帝国CMSphp显示乱码 求指教--------ul?phpmysql_connect(localhost,htebhcom,r5w8f8) or die(da

帝国CMS php显示乱码 求指教--------
<ul>
<?php
  mysql_connect('localhost','htebhcom','r5w8f8') or die('database server no exists!');
  mysql_select_db('htebhcom')or die('database error!');
  mysql_query("set names utf-8");
  mysql_query("SET CHARACTER_SET_CLIENT=utf-8"); //服务器设置客户端编码
  mysql_query("SET CHARACTER_SET_RESULTS=utf-8");//设置查询结果的编码
  ini_set("display_errors", "off");
  date_default_timezone_set('PRC');
   
?>
<?php
  $result=mysql_query("select * from phome_ask_speak order by id desc limit 6");  
  while($arr=mysql_fetch_array($result)){
?>  
   
  <li><a href="[!--news.url--]ask/show.php?id=<?php echo $arr['id'];?>" target="_blank" title="<?php echo substr($arr['topic'],0,36);?>"><?php echo substr($arr['topic'],0,36);?></a></li>
<?php } ?>
  </ul>

数据库编码是utf_8,页面head也有写 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

 上面这短代码还是显示乱码。 请问是什么问题??????? 求指教····· 


[解决办法]
mysql_query("set names utf8");
另外,确认你的文件也是utf-8编码

热点排行