我想传递这样的对象(JavaScript 示例)
var auth = new Object();
auth.method = "authenticateUser";
auth.data = new Object();
auth.data.email = "user11111@test.com";
auth.data.password = "123123";
当我发帖时到 php 脚本。
到目前为止,我只能通过附加到 url 来传递单个变量,但我希望能够传递嵌套对象 - 例如在上面的 javascript 示例中
NSString *post =[NSString stringWithFormat:@"username=%@&password=%@",usernameField.text, passwordField.text];
NSString *hostStr = @"{ANY URL}";
hostStr = [hostStr stringByAppendingString:post];
NSData *dataURL = [NSData dataWithContentsOfURL: [ NSURL URLWithString: hostStr ]];
NSString *serverOutput = [[NSString alloc] initWithData:dataURL encoding: NSASCIIStringEncoding];