【问题标题】:POSTing with Flash使用 Flash 发布
【发布时间】:2012-09-13 05:37:36
【问题描述】:

我一直在尝试让以下代码工作:

var scriptRequest:URLRequest = new URLRequest("http://mywebsite.com/script.php");
var scriptLoader:URLLoader = new URLLoader();
var scriptVars:URLVariables = new URLVariables();

scriptLoader.addEventListener(Event.COMPLETE, handleLoadSuccessful); scriptLoader.addEventListener(IOErrorEvent.IO_ERROR, handleLoadError);

function write(write_to_file) {      
scriptVars.req = "testing testing testing";

scriptRequest.method = URLRequestMethod.POST;
scriptRequest.data = scriptVars;

scriptLoader.load(scriptRequest); }

function handleLoadSuccessful($evt:Event):void
{

    trace("消息已发送。");

}

函数handleLoadError($evt:IOErrorEvent):void { trace("消息失败。"); }


奇怪的是,它可以从 Flash 正确 POST.. 但是当我上传到我的网络服务器时它没有...有什么想法吗?

谢谢 亚历克斯

【问题讨论】:

    标签: flash post


    【解决方案1】:
    1. 您可以使用 Web 调试器(charles、fiddler 等)检查发送到远程 url 的变量。它可以帮助您查看发送的变量是什么。
    2. 另外不要忘记检查您是否使用 $_POST 来接收数据

    以您使用的相同方法或 $_REQUEST 等常用方法接收数据很重要。

    我想这就是你的问题。

    【讨论】:

      猜你喜欢
      • 2013-08-11
      • 1970-01-01
      • 2010-10-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-01
      • 2014-07-11
      相关资源
      最近更新 更多