我创建通过以下POST方法客观-CPOST方法
-(IBAction) postLocation: (id) sender{
NSString *latitude = @"37.3229978";
NSString *longitude = @"-122.0321823";
NSMutableURLRequest *request =[NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://www.mydomain.me/webservice.php"]];
[request setHTTPMethod:@"POST"];
NSString *post =[[NSString alloc] initWithFormat:@"latitude=%@longitude=%@submit",latitude,longitude];
[request setHTTPBody:[post dataUsingEncoding:NSUTF8StringEncoding]];
NSURLResponse *response;
NSError *err;
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err];
}
和我的PHP代码:
if (isset($_POST['submit']){
//it doesn't get into this if statement
$latitude = $_POST['latitude'];
$longitude = $_POST['longitude'];
}
的问题是,为什么不能PHP代码进入if语句?我在哪里可以通过Objective-C来陈述'提交'?
你有没有找到答案?我有这个确切的问题:http://stackoverflow.com/questions/13110180/php-get-value-erased-when-placed-in-ifisset – Celeste 2012-10-29 10:08:43