1

我希望能够从 flash 媒体服务器 3.5 连接到 Zend_Amf(最新的 ZendFramework 版本)。我尝试执行以下操作:

function amfresponder ( ) {
this.onResult = function (result) {
    trace("Success: " + String(result));
};
this.onStatus = function (fault) {
    trace("Error: "+ fault.description);
};
};


application.onConnect = function(client) {

myResponder = new amfresponder();

connection = new NetConnection();

connection.connect("http://localhost/AmfServer.php");
trace("checking connection");
connection.call("isConnected",myResponder);

return true;    
}

我在 apache 访问日志中看到了对 AmfServer.php 的请求,但没有返回任何内容,甚至没有返回错误消息。在 fms 管理日志上,我只看到“检查连接”。

更新

另一种方法:

application.isFine_Status = function(info) {
  for(var item in info) {
    trace(item + " " + info[item]);
  } 
}

application.isFine_Result = function(res) {
    trace(res);
}

application.onAppStart = function() {
trace("application started");
NetServices.setDefaultGatewayUrl("http://localhost/AmfServer.php");
    this.gatewayconn = NetServices.createGatewayConnection();   
    this.pservice = this.gatewayconn.getService('PrivateFunc',this);
    this.pservice.isFine();
}

Zend_Amf 类是:

set_include_path(get_include_path().PATH_SEPARATOR.realpath(__DIR__.'/../').PATH_SEPARATOR.realpath(__DIR__.'/../../include/PEAR-R2'));

require_once('Zend/Amf/Server.php');
require_once('PrivateFunc.php');

$server = new Zend_Amf_Server();
$server->setClass('PrivateFunc','PrivateFunc');
$response = $server->handle();
echo $response;

在这两种情况下,我都没有任何结果。有任何想法吗?

4

2 回答 2

1

您可能想在下面尝试此代码

setClass("PrivateFunc"); // 需要启动服务器 $handle = $server->handle(); 回声($句柄);//echo($server->handle()); ?>
于 2010-06-15T12:54:09.297 回答
0

好的,所以经过大量研究,目前似乎无法从 adobe flash 媒体服务器到 zend_amf 进行正确连接。

我通过从 adobe flash 媒体服务器转移到它的免费解决方案 red5 解决了这个问题。red5 是基于 java 的,它提供了一种非常强大的编程语言,所以我将相关代码从 php 转换为 java,一切(数据库操作)都在 red5 中完成,并且不需要全部 php。

于 2010-01-10T15:12:49.453 回答