!php+ajax+ json 有关问题

WBOY
发布: 2016-06-13 12:31:31
原创
847 人浏览过

求助!!php+ajax+ json 问题

本帖最后由 zl2727 于 2013-12-10 18:08:23 编辑
<br />
function gtou($s) { return iconv('gbk', 'utf-8', $s); }<br />
$proquery ="select * from pro where typeid='".$id."' order by corank asc";<br />
 $dsql->SetQuery($proquery); <br />
$dsql->Execute(); <br />
$a=array();<br />
 while($row = $dsql->GetArray())<br />
 {<br />
 $a[]= array_map('gtou', $row); <br />
} <br />
$res = array(<br />
 "status" => "1",<br />
 "result" => $a,<br />
 "moreUrl" => $moreurl, );<br />
 echo json_encode($res);<br />
 
登录后复制

 现在前台 返回值是{"status":"1","result":[],"moreUrl":"http:\/\/wcn"} result 是空的 
如果 
echo json_encode($res);
换成下面的 
//echo '{"status":"1","result":[{"id":"1","typeid":"111","goodstitle":"\u8865\u6c34\u6da6\u80a4\u818f \u771f\u7684\u5f88\u597d \u5f88\u8865\u6c34 \u76ae\u80a4\u6709\u5f39\u6027","goodsurl":"http:\/\/www.\/uploads\/allimg\/c131205\/13V23912150-114L_lit.jpg","brandtitle":"\u7f8e\u5b9d\u83b2","brandurl":"http:\/\/www.\/dsadasdas\/","imgurl":"http:\/\/www.\/sadas213\/","price":"59.9","corank":"1"},{"id":"2","typeid":"111","goodstitle":"\u8865\u6c34\u6da6\u80a4222","goodsurl":"http:\/\/www.\/uploads\/allimg\/c131205\/13V23912150-114L_lit.jpg","brandtitle":"\u7f8e222","brandurl":"http:\/\/www.\/dsadasdas\/","imgurl":"http:\/\/www.\/sadas213\/","price":"59.9","corank":"1"}],"moreUrl":"http:\/\/jianfei.\/shuiguo\/"}'; 就正确了
 请大神们帮个忙 版主也麻烦您再次指导以下
相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板