get请求
url = [[ NSURL alloc] initWithString:@"http://www.********.com.cn:8081/index.php/Account/iphoneTopup?email=a@a.com&password=1&amount=12"];
[WebView
loadRequest:[ NSURLRequest requestWithURL: url ]]; //习惯采用loadRequest方式,你可采用其他方式
post请求
NSURL *url = [NSURL URLWithString: @"http://www.*******.com.cn:8081/index.php/Account/iphoneTopup"];
NSString *body = [NSString stringWithFormat: @"email=%@&password=%@&amount=%@",@"a@a.com",@"1",@"12"];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc]initWithURL: url];
[request setHTTPMethod: @"POST"];
[request setHTTPBody: [body dataUsingEncoding: NSUTF8StringEncoding]];
[WebView loadRequest: request];
webview链接 get和post请求传值给链接的页面
最新推荐文章于 2021-03-24 13:55:52 发布