我希望能够从 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;
在这两种情况下,我都没有任何结果。有任何想法吗?