thinkphpはJsonのデータフォーマットを返します

867 ワード

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 �n: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開発者の皆さんに役立つことを願っています.
この文書は次のとおりです.http://www.2cto.com/kf/201312/269160.html