首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >URLVariables在Haxe项目中不起作用

URLVariables在Haxe项目中不起作用
EN

Stack Overflow用户
提问于 2015-10-14 20:35:49
回答 1查看 238关注 0票数 1

你好吗?我希望一切都好。

所以我尝试发送一个urlRequest,但是我不能通过url传递参数,所以我尝试使用URLVariable,但是不管我怎么尝试,我的php总是得到null。

代码语言:javascript
复制
        var request:URLRequest = new URLRequest(SITE_DOMAIN + "/check_login.php");
        request.method = URLRequestMethod.POST; 
        var variables:URLVariables = new URLVariables();
        variables.login = emailInput.text;
        variables.password = senhaInput.text;
        variables.gotogame = "BURACO";
        Reflect.setField(variables, "login", emailInput.text);
        Reflect.setField(variables, "password", senhaInput.text);
        Reflect.setField(variables, "gotogame", "BURACO");
        request.data = variables;
        request.method = URLRequestMethod.POST;
        openfl.Lib.getURL(request);

正如你们看到的,我试图用两种方法来设置变量,但是这两种方法都不起作用,我也不知道该怎么做了,请帮帮忙。

EN

回答 1

Stack Overflow用户

发布于 2015-10-14 21:11:42

我已经毫无问题地使用了它:

代码语言:javascript
复制
    var request:Http = new Http(SERVER + "actions/layout-builder?random=" + Math.random());
    request.addParameter("action", "retrieve");
    request.addParameter("layoutId", layoutId);
    request.onError = function(msg) {
        showSimplePopup("Problem loading layout:\n\n" + msg);
    }
    request.onStatus = function(status:Int) {
    }
    request.onData = function(response) {
        response = StringTools.replace(response, "\r\n", "\n");
        layoutCode.text = response;
    }

    request.request(false);
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33125489

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档