thinkphp返回Json數據格式
//編寫類方法用$this->ajaxReturn()返回數據
public function index(){
$setting = M('setting');
$map['lang'] = array('in','1,0');
$data = $setting->where($map)->field('name,data')->select();
$this->ajaxReturn($data,'JSON');
}(PS:PHP Q扣峮:276167802,驗證:csl)[{"name":"site_name","data":"\u4e0a\u6d77\u610f\u9017\u4fe1\u606f\u6280\u672f\u6709\u9650\u516c\u53f8"},{"name":"site_title","data":"\u624b\u673aAPP,\u624b\u673a\u7f51\u7ad9\u5efa\u8bbe,\u4e0a\u6d77\u610f\u9017\u4fe1\u606f\u6280\u672f\u6709\u9650\u516c\u53f8"}]
以上是本文關於thinkphp返回Json的數據格式,希望本文對廣大php開發者有所幫助,感謝閱讀本文。