curl请求的url中含有空格时(例如rul的参数是sql查询语句,url=www.tets.com/query.php?sql=select * from t1),curl_easy_perform()将不会得到正确的结果. 需要处理一下空格,用%20替换掉每一个空格,即将select * from t1换成select%20*%20from%20t1…
一,代码. - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. //直接传是没反应的,去掉其中的空格 NSString *url=[[NSString stringWithFormat:@"http://baidu.com"] stringByAddingPercentEscapesUsingEncoding…