1

你好吗?我希望没事。

所以我试图发送一个 urlRequest 并且我无法通过 url 传递参数,所以我试图使用 URLVariable,但无论我尝试什么,我的 php 总是得到空值。

        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);

正如你们所看到的,我正在尝试以两种方式设置变量,但它们都不起作用,我有点不知道该怎么做,请帮忙。

4

1 回答 1

3

我用这个没有问题:

    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);
于 2015-10-14T13:11:41.920 回答