【发布时间】:2012-07-13 16:28:16
【问题描述】:
我需要将一些 post 参数传递给服务器,但 php 得到一个空数组 $_POST 这是我的代码:
NSString* user=UserNameField.stringValue;
NSString* pass=PasswordField.stringValue;
NSString* ID=IDField.stringValue;
NSURL *url = [NSURL URLWithString:ENTERANCE];
url = [NSURL URLWithString:@"http://sphere-beauty.com/test.php"];
NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url];
NSString* post=[NSString stringWithFormat:@"uname=%@&passwd=%@&id=%@",user,pass,ID];
[req setHTTPMethod:@"POST"];
[req setHTTPBody: [post dataUsingEncoding:NSUTF8StringEncoding]];
[[browser mainFrame] loadRequest:req];
谁能帮忙?
【问题讨论】:
-
设置 URL 然后覆盖它有什么意义?
-
那只是为了测试,看post数据
标签: xcode macos webview httprequest