关于sql查询问题,请大神进来看下,谢谢!
$sql= "select distinct cs_brand_name from tb_cars where cs_brand_initials = 'A' or cs_brand_name like'%奥%' ";echo $sql;
$query=$this->db->query($sql);
$result= $query->result();
return $result;
echo json_encode($result);
这是我自定义查询语句返回的值
[{"cs_brand_name":"\u5965\u8fea"},{"cs_brand_name":"\u5965\u514b\u65af"},{"cs_brand_name":"\u963f\u5c14\u6cd5\u00b7\u7f57\u7c73\u6b27"},{"cs_brand_name":"\u963f\u65af\u987f\u00b7\u9a6c\u4e01"},{"cs_brand_name":"AC Schnitzer"}]
怎么成编码了?
json_encode了 是转成json了,就是unicode编码了。。。 ljc 发表于 2014-4-17 14:03
json_encode了 是转成json了,就是unicode编码了。。。
查了下资料,才知道JSON不能转汉字,怎么整呢?
json_decode(),就能转成原有的数组了 PHP里
json_decode($result), 就好了
js里 用的是jquery
$.post(url,data,function(msg){
//js直接循环json
$(msg).each(function(i,item){
document.write(item.cs_brand_name);
});
},'json')
页:
[1]