我正在使用ZendAMF协议使用Flex和PHP开发Web应用程序。从昨天开始,每当我将应用程序发布到远程服务器时,都会出现这个奇怪的问题。 本地一切都很好,只有当我在服务器上发布它时。这是我得到的ErrorMessage:
Send failed
Channel.Security.Error error Error #2048: Security sandbox violation: http://mydomain.com/login/MainFrame.swf cannot load data from http://localhost/bin-debug/gateway.php. url: 'http://localhost/bin-debug/gateway.php'
我很确定我的gateway.php和amf_config文件没有任何问题,因为我知道它们略有不同。 (我在备份的地方使用这些文件,但事情确实有效)
此外,我还在web根目录和应用程序目录上复制了我的crossdomain.xml,它自动进入。这是内容:
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>
问题是在生产版本中它仍然试图访问本地文件。我试过很多关于这个问题的搜索但是没有找到与我的情况相同的事情。
gateway.php源代码
<?php
ini_set("display_errors", 1);
$dir = dirname(__FILE__);
$webroot = $_SERVER['DOCUMENT_ROOT'];
$configfile = "$dir/amf_config.ini";
//default zend install directory
$zenddir = $webroot. '/ZendFramework/library';
//Load ini file and locate zend directory
if(file_exists($configfile)) {
$arr=parse_ini_file($configfile,true);
if(isset($arr['zend']['webroot'])){
$webroot = $arr['zend']['webroot'];
$zenddir = $webroot. '/ZendFramework/library';
}
if(isset($arr['zend']['zend_path'])){
$zenddir = $arr['zend']['zend_path'];
}
}
我可以尝试下一步来解决这个问题吗?
答案 0 :(得分:-1)
http://mydomain.com/
需要http://localhost/
在这种情况下,您的http://localhost/crossdomain.xml
应该允许来自http://mydomain.com/
确保您的crossdomain.xml正常