Flash+AMFPHPは素晴らしい組み合わせです。ただし、さまざまな理由により、NetConnectionを使用したFlashRemotingが適切なツールではない場合があります。ロブはこれについて少し前に素晴らしい投稿をしました:http ://www.roboncode.com/articles/144
彼はまた、Zend_AMFを使用してNetConnectionが送信する関数を呼び出すPOSTおよびAMF-requestパッケージを使用せずに、AMFをhttp要求に配信する方法についての良い例を持っています。
// Include the Zend Loader
include_once 'Zend/Loader.php';
// Tell the Zend Loader to autoload any classes we need
// from the Zend Framework AMF package
Zend_Loader::registerAutoload();
// Create a simple data structure
$data = array('message' => 'Hello, world!');
// Create an instance of an AMF Output Stream
$out = new Zend_Amf_Parse_OutputStream();
// We will serialize our content into AMF3 for this example
// You could alternatively serialize it as AMF0 for legacy
// Flash applications.
$s = new Zend_Amf_Parse_Amf3_Serializer($out);
$s->writeObject($data);
// Return the content (we have found the newline is needed
// in order to process the data correctly on the client side)
echo "\n" . $out->getStream();
私はこのアプローチが本当に好きで、AMFPHPでそれを複製するのはとてもうれしいでしょう。なぜAMFPHP、あなたは尋ねますか?「最新」バージョンは、C PHP拡張機能であるamf-extを使用して、データをシリアル化および逆シリアル化します。ZendAMFがまだ使用しているphpの方法よりもはるかに高速です。
もちろん、私はすでにAMFPHPをいじって、必要なオブジェクトを作成し、Serializerクラスを使用しようとしました。有効なAMF文字列も取得しましたが、実際のデータは常に「メソッドパッケージ」によってラップされ、これが「Service.method」呼び出しに対する応答であることを受信者に通知していました。
では、AMFPHPで、ゲートウェイとメソッドラッパーを使用せずに、Flashオブジェクトを直接シリアル化する方法はありますか?
ありがとう。