在 AS 3 中URL请求 http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLRequest.html您用来指定请求的类有一个method http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLRequest.html#method属性可用于设置提交方法的 HTTP 选项,您需要使用以下命令将其设置为 POSTURL请求方法 http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLRequestMethod.html持续的POST http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLRequestMethod.html#POST为了完美的形式,或者您可以使用“POST”字符串。
你可以找到一个综合例子 http://snipplr.com/view/4487/ on snipplr http://snipplr.com/
简而言之:
var url:String = "http://localhost/myPostReceiver.php";
var request:URLRequest = new URLRequest(url);
var requestVars:URLVariables = new URLVariables();
requestVars.foo = "bar";
// ... fill in your data
request.data = requestVars;
request.method = URLRequestMethod.POST;
// after this load your url with an UrlLoader or navigateToUrl
使用 Adobe Air 时,您需要使用网址加载器 http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLLoader.html类而不是导航到URL() http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/package.html#navigateToURL%28%29因为以下花絮:
参数
request:URLRequest — 指定要导航到的 URL 的 URLRequest 对象。
对于在 Adobe AIR 中运行的内容,当使用 navigatorToURL() 函数时,运行时会将使用 POST 方法(其 method 属性设置为 URLRequestMethod.POST 的方法)的 URLRequest 视为使用 GET 方法.
基本上只要您想正确使用 POST 设置方法,也如文档所示导航到网址 http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/package.html#navigateToURL%28%29:
接下来在 php 中您将收到超全局变量$_POST http://www.php.net/manual/en/reserved.variables.post.php数组,您可以在其中访问它:
<?php
$foo = $_POST['foo'];
/* $foo now contains 'bar'
assignment to another value is not necessary to use $_POST['foo']
in any function or statement
*/