当前位置:Gxlcms > PHP教程 > Decodeamf3objectusingPHP

Decodeamf3objectusingPHP

时间:2021-07-01 10:21:17 帮助过:7人阅读

as3:

代码

var request = new URLRequest( ' http://localhost/test.php ' );
request.method = URLRequestMethod.POST;
var data = new URLVariables();
var bytes:ByteArray = new ByteArray();
bytes.objectEncoding = ObjectEncoding.AMF3;
// write an object into the bytearray
bytes.writeObject(
{ myString: " Hello World " }
);
data.data = bytes;
request.data = data;

var urlLoader:URLLoader = new URLLoader();
urlLoader.dataFormat = URLLoaderDataFormat.BINARY;
urlLoader.addEventListener(Event.COMPLETE, onCompleteHandler);
urlLoader.load(request);

function onCompleteHandler(evt:Event): void {
trace(evt.target.data);
}

php:

define ( " AMF_AMF3 " , 1 );
$data = $_POST [ ' data ' ];
echo amf_decode( $data , AMF_AMF3);

人气教程排行