您的位置 首页 php

如何把destoon数据生成json

destoon是商务信息网站程序,相信大家用这个程序建站,后来不知道怎么制作json数据,网站搜索也没有找到答案,今天给大家分享如何把destoon数据生成json,用于百度小程序、QQ小程序和微信小程序。

由于系统是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);

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;

?>

希望对有帮助

文章来源:智云一二三科技

文章标题:如何把destoon数据生成json

文章地址:https://www.zhihuclub.com/76998.shtml

关于作者: 智云科技

热门文章

网站地图