由于系统是GB2312编码,以是做事端编写的时候我们进行了一些编码转换的处理,担保做事端访问的编码是UTF-8就可以。不多了,下面干货来了。如果你是程序或此段代码对你有帮助,希望收藏!
!
<?php
header(34;Content-Type: text/html;charset=utf-8");
define('DT_REWRITE', true);
require '../common.inc.php';
$lists = array();
//展示栏眼前的子栏目;
if(!empty($areaid)){
if(!$AREA[$areaid]["parentid"]){
$condtion="and areaid in (".$AREA[$areaid]["arrchildid"].")";
$condtions="areaid in (".$AREA[$areaid]["arrchildid"].")";
}else{ $condtion="and areaid=$areaid"; $condtions="areaid=$areaid"; }
}
//echo打印destoon数据;
if(empty($areaid)) {
$sql_brand="select itemid,areaid,catid,title,company,hits,edittime,thumb(字段) from dt_brand_13(表名) order by hits desc limit 0,14";
}
//$sql_brand="select 字段 from 表名 order by hits desc limit 0,14";
$result=$db->query($sql_brand);
while($r = $db->fetch_array($result)) {
$lists[] = $r;
}
$str=json_encode($lists);
$str= preg_replace("#\\\u([0-9a-f]+)#ie","iconv('UCS-2','UTF-8', pack('H4', '\\1'))",$str);
echo $str;
?>
希望对有帮助