我正在寻找一个简单的代码,使用textfiel在目标c中编写一个字符串并将其发送到php .

例如,所以在互联网页面中我看到了 Headers :

用PHP

<?php 
$title = $_POST['title'];
 echo "Title: ". $title;
?>

和目标c

NSString * eventTitle = @“test”; NSString * myRequestString = [NSString stringWithFormat:@“title =%@”,eventTitle]; NSData * myRequestData = [NSData dataWithBytes:[myRequestString UTF8String] length:[myRequestString length]]; NSMutableURLRequest * request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@“http://www.myDomain.com/phpfilename.php”]]; [请求setHTTPMethod:@“POST”]; [请求setValue:@“application / x-www-form-urlencoded”forHTTPHeaderField:@“content-type”]; [request setHTTPBody:myRequestData]; NSData * returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]; NSString * response = [[NSString alloc] initWithBytes:[returnData bytes] length:[returnData length] encoding:NSUTF8StringEncoding];的NSLog(@ “%@”,响应);

对不起,如果他们是简单的新手与PHP

谢谢大家