Home > Backend Development > PHP Tutorial > Decode amf3 object using PHP

Decode amf3 object using PHP

WBOY
Release: 2016-06-23 14:35:05
Original
957 people have browsed it

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


 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template