Thinkphp returns the Json data format. Thinkphp returns Json data to write class methods using $ this-ajaxReturn () to return data publicfunctionindex () {$ settingM (setting); $ map [lang] array (in ); $ data $ setti
ThinkphpReturn
JsonData format
// Write the class method using $ this-> ajaxReturn () to return the 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 button: 276167802, verification: csl)
The returned data page is displayed as follows:
[{"Name": "site_name", "data ": "\ Users \ 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 "}]
The above is the data format in which thinkphp returns Json. I hope this article will be helpful to php developers. thank you for reading this article.
The http://www.bkjia.com/PHPjc/635019.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/635019.htmlTechArticlethinkphp returns the Json data type // The write class method returns the data public function index () {$ setting = M ('setting') with $ this-> ajaxReturn '); $ map ['Lang '] = array ('in', '1, 0'); $ data = $ setti...