由于系统是GB2312编码,所以服务端编写的时候我们进行了一些编码转换的处理,保证服务端访问的编码是UTF-8就可以。不多了,下面干货来了。如果你是程序或此段代码对你有帮助,希望收藏!!
>?php
header("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);< p="" style="-webkit-tap-highlight-color: transparent; box-sizing: border-box; color: inherit; margin: 0px; outline: none; border: 0px; padding: 0px; list-style: none; font-size: inherit;">
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;
?<
希望对大家有帮助