我对iOS很新。我正试图通过post方法将数据发送到PHP。在PHP中,它不能采用像$_POST['data']
这样的数据,但它需要$_GET['data']
。我的iOS代码如下。IOS发送post方法数据可以在php中作为get方法访问
NSString *strURL = [NSString stringWithFormat:@"http://example.com/app_respond_to_job?emp_id=%@&job_code=%@&status=Worker-Accepted&comment=%@",SaveID2,txtJobcode1,alertTextField.text];
NSURL *apiURL = [NSURL URLWithString:strURL];
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:apiURL];
[urlRequest setHTTPMethod:@"POST"];
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self];
_receivedData = [[NSMutableData alloc] init];
[connection start];
NSLog(@"URL---%@",strURL);
有人可以解释为什么,这将是非常有益的。