The original in win under the development, so write is so, by the Stufamilyjson method to put the code:
public function stuFamilyJson(){ $tb=D('StuFamily'); $familyInfo=$tb->where('stu_id='.session('userId'))->select(); foreach ($familyInfo as $key=>$familyInfoEach) $familyInfo[$key]=$tb->parseFieldsMap($familyInfoEach); echo $familyInfo=json_encode($familyInfo); }
Using the browser Developer tool, the following values are returned:
[{"id":"1","stuId":"1","folkName":"\u7236\u4eb2\u5927\u4eba","folkRelation":"\u7236\u5b50","folkCompany":"\u7236\u4eb2\u7684\u5355\u4f4d","folkPosition":"\u5de5\u4eba2","folkTel":"12345678910","folkAddress":"\u7ed9\u5927\u5bb6\u8bf4\u670di\u4e3au\u5346"},{"id":"2","stuId":"1","folkName":"\u6bcd\u4eb2\u5927\u4eba","folkRelation":"\u6bcd\u5b50","folkCompany":"\u6bcd\u4eb2\u7684\u5355\u4f4d","folkPosition":"\u5de5\u4eba","folkTel":"12345678910","folkAddress":"\u5bf9\u65b9\u7b54\u590d"},{"id":"6","stuId":"1","folkName":"\u5144\u957f\u5927\u4eba","folkRelation":"\u5144\u5f1f","folkCompany":"\u65e0","folkPosition":"\u65e0","folkTel":"123456","folkAddress":"\u70ed\u70ed\u70ed\u4ed6 \u5c14\u7279\u8ba9\u4ed6"}]
Note: This part of the Chinese characters are encoded, here do not restore.
But now write this, the front desk will not show the data!
Paste the returned data directly into a JSON file, and the URL changes to the JSON file, which will display correctly.
However, this is not a good way, after all, to interact with the database, of course, you may say let the background operation, the result is written to the JSON file, so it is true, but I do not like it.
And thought of this:
So the discovery can also be displayed normally.
Then, the question comes, I directly write the URL and so with JS write what is the difference? Why is there a problem with direct URL writing? There is another ComboBox, also written with the URL, just finished, after a few days it is not good to make, do not know what is the reason, I think the two are the same cause. Ask the great God for help!!