【发布时间】:2017-09-20 04:53:33
【问题描述】:
我也想在 post 参数中发送表单名称, html 例如:
<form id='form1' name='ecom' action='abc.com' method='POST'>`
<input Parameters .... /> </form>
我正在使用的当前方法:
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:@"%lu",(unsigned long)[postData length]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:baseUrl]];
[request setHTTPMethod:@"POST"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Current-Type"];
[request setHTTPBody:postData];
这里可以很好地发布参数,但我还需要发送表单名称。
【问题讨论】:
-
如果为表单名称添加另一个标题字段会怎样
-
你能给我举个例子吗?
标签: html ios objective-c afnetworking