ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
## 代码 ``` /** * 1. 占座回调地址 * @url https://www.juhe.cn/docs/api/id/173/aid/583 */ public function submit_callback() { $path ="/home/submit_callback.txt"; file_put_contents($path, json_encode($_POST)); } ``` ![mark](http://qiniu.newthink.cc/blog/20171204-112242860.png) ## 回调结果 ``` {"data":"{\"from_station_name\":\"\u5317\u4eac\u5357\",\"from_station_code\":\"VNP\",\"to_station_name\":\"\u4e0a\u6d77\u8679\u6865\",\"to_station_code\":\"AOH\",\"train_date\":\"2017-12-09\",\"orderid\":\"JH151235759891342\",\"user_orderid\":\"201712041119587544404\",\"orderamount\":\"553.00\",\"ordernumber\":\"E975499210\",\"checi\":\"G101\",\"msg\":\"\u5904\u7406\u6216\u64cd\u4f5c\u6210\u529f;\u5f85\u652f\u4ed8\",\"status\":\"2\",\"passengers\":[{\"passengerid\":\"68\",\"passengersename\":\"\u6768\u7ea2\u4f1f\",\"piaotype\":1,\"piaotypename\":\"\u6210\u4eba\u7968\",\"passporttypeseid\":\"1\",\"passporttypeseidname\":\"\u4e8c\u4ee3\u8eab\u4efd\u8bc1\",\"passportseno\":\"142201198311174558\",\"price\":\"553.0\",\"zwcode\":\"O\",\"zwname\":\"\u4e8c\u7b49\u5ea7\",\"ticket_no\":\"E975499210110006A\",\"cxin\":\"10\u8f66\u53a2,06A\u5ea7\",\"reason\":0}],\"refund_money\":null,\"sign\":\"bc0ad41a4a1296dd401b4f528648aaa0\"}"} ``` >注:这次得到的数据其实不是json,挺奇怪的,有时间再研究吧! ## 经过整理 ``` { "data":"{ "from_station_name":"\u5317\u4eac\u5357", "from_station_code":"VNP", "to_station_name":"\u4e0a\u6d77\u8679\u6865", "to_station_code":"AOH", "train_date":"2017-12-09", "orderid":"JH151235759891342", "user_orderid":"201712041119587544404", "orderamount":"553.00"," ordernumber":"E975499210", "checi":"G101", "msg":"\u5904\u7406\u6216\u64cd\u4f5c\u6210\u529f;\u5f85\u652f\u4ed8", "status":"2", "passengers":[ { "passengerid":"68", "passengersename":"\u6768\u7ea2\u4f1f", "piaotype":1, "piaotypename":"\u6210\u4eba\u7968", "passporttypeseid":"1", "passporttypeseidname":"\u4e8c\u4ee3\u8eab\u4efd\u8bc1", "passportseno":"142201198311174558", "price":"553.0", "zwcode":"O", "zwname":"\u4e8c\u7b49\u5ea7", "ticket_no":"E975499210110006A", "cxin":"10\u8f66\u53a2,06A\u5ea7", "reason":0 } ], "refund_money":null, "sign":"bc0ad41a4a1296dd401b4f528648aaa0" }" } ``` json_decode($data); 是一个对象的字符串 json_decode($data,true); 是一个数组的字符串;