Thinkphp returns Json data & amp; 26684;. class method: Use $ this-& gt; ajaxReturn () to return data publicfunctionindex () {$ setting = M (& 039; setting & 039;); $ map [& 039; lang & 039;]
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 buckle? N: 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.