Last Update:2016-06-06
Source: Internet
Author: User
Keywords
Php
swift
objective-c
ios
Let AFN = Afhttprequestoperationmanager () AFN. POST ("http://api.abc.com//index.php?s=/home/order/makeorder.html", Parameters: ["Data": "22222"], success: {(ope ration:afhttprequestoperation!, responseobject:anyobject!) In print ("%@", operation.request.allHTTPHeaderFields); Let data = Responseobject as! nsdictionary! Print ("Gets data ==%@", data) if data! = Nil {//Let Dict:nsdictionary = (try! Nsjsonserialization.jsonobjectwithdata (data!, Options:. allowfragments)) as! Nsdictionary/Let Modeltool = dictmodelmanager.sharedmanager//Let data = modeltool.objectw Ithdictionary (data, cls:FreshHot.self) as? Freshhot//completion (Data:data, Error:nil)}}, FAI Lure: {(operation:afhttprequestoperation!, error:nserror!) in//handle error Print ("Get dataError =%@ ", error); })
The $_post data received by PHP in the background is
a:1:{s:4:"data";s:5:"22222";}
Try to unserialize the $_post, but not the data,
file_get_contents (' Php://input ') gets the data that is
s:10:"data=22222";
How does PHP handle afnetworking post data?
Reply content:
Let AFN = Afhttprequestoperationmanager () AFN. POST ("http://api.abc.com//index.php?s=/home/order/makeorder.html", Parameters: ["Data": "22222"], success: {(ope ration:afhttprequestoperation!, responseobject:anyobject!) In print ("%@", operation.request.allHTTPHeaderFields); Let data = Responseobject as! nsdictionary! Print ("Gets data ==%@", data) if data! = Nil {//Let Dict:nsdictionary = (try! Nsjsonserialization.jsonobjectwithdata (data!, Options:. allowfragments)) as! Nsdictionary/Let Modeltool = dictmodelmanager.sharedmanager//Let data = modeltool.objectw Ithdictionary (data, cls:FreshHot.self) as? Freshhot//completion (Data:data, Error:nil)}}, FAI Lure: {(operation:afhttprequestoperation!, error:nserror!) in//handle error Print ("Get dataError =%@ ", error); })
The $_post data received by PHP in the background is
a:1:{s:4:"data";s:5:"22222";}
Try to unserialize the $_post, but not the data,
file_get_contents (' Php://input ') gets the data that is
s:10:"data=22222";
How does PHP handle afnetworking post data?