错误信息:
fault(mx.messaging.messages::ErrorMessage)#0
body = (Object)#1
clientId = (null)
correlationId = "3541ADD2-5245-3C38-A8B6-92DFC59DA055"
destination = ""
extendedData = (null)
faultCode = "Client.Error.MessageSend"
faultDetail = "Channel.Connect.Failed error NetConnection.Call.BadVersion: : url: 'http://localhost/amfphp/gateway.php'"
faultString = "发送失败"
headers = (Object)#2
messageId = "70675B80-508D-99F8-87B2-92DFCA00B9D7"
rootCause = (mx.messaging.events::ChannelFaultEvent)#3
bubbles = false
cancelable = false
channel = (mx.messaging.channels::AMFChannel)#4
authenticated = false
channelSets = (Array)#5
connected = false
connectTimeout = -1
enableSmallMessages = true
endpoint = "http://localhost/amfphp/gateway.php"
failoverURIs = (Array)#6
id = "my-amfphp"
mpiEnabled = false
netConnection = (flash.net::NetConnection)#7
client = (mx.messaging.channels::AMFChannel)#4
connected = false
maxPeerConnections = 8
objectEncoding = 3
proxyType = "none"
uri = "http://localhost/amfphp/gateway.php"
piggybackingEnabled = false
polling = false
pollingEnabled = true
pollingInterval = 3000
protocol = "http"
reconnecting = false
recordMessageSizes = false
recordMessageTimes = false
requestTimeout = -1
uri = "http://localhost/amfphp/gateway.php"
url = "http://localhost/amfphp/gateway.php"
useSmallMessages = false
channelId = "my-amfphp"
connected = false
currentTarget = (mx.messaging.channels::AMFChannel)#4
eventPhase = 2
faultCode = "Channel.Connect.Failed"
faultDetail = "NetConnection.Call.BadVersion: : url: 'http://localhost/amfphp/gateway.php'"
faultString = "error"
reconnecting = false
rejected = false
rootCause = (Object)#8
code = "NetConnection.Call.BadVersion"
description = ""
details = ""
level = "error"
target = (mx.messaging.channels::AMFChannel)#4
type = "channelFault"
timestamp = 0
timeToLive = 0
上面的都是报错的信息,调试了大半天还是这样,如果单独一个.mxml内部调用,就没有报错,但是用别的模块去调用这个.mxml的时候,就会出现这个情况了.
而我将项目放上去 外网服务器测试 可以正常返回测试的信息,但是在本机调试,就出现上面的错误信息了
外网服务上AMFPHP是在本机相同文件夹上拖过去的.所以如此出错也是百思不得其解;
后来逛到天地会后发现一篇 关于AMFPHP1.9错误的处理方法:
我本机的解决办法就是按照下面第一点的方法 单独把 //$gateway->disableStandalonePlayer();注释掉就OK了!
(以下内容转自天地会- 后台技术讨论区 » 关于AMFPHP新版一些问题解决办法)
AMFPHP 1.9新版问题修改
1、Flash环境下访问方法失败,而自带调试SWF正常,修改amfphp\gateway.php如下内容:
if(PRODUCTION_SERVER)
{
//Disable profiling, remote tracing, and service browser
$gateway->disableDebug();
// Keep the Flash/Flex IDE player from connecting to the gateway. Used for security to stop remote connections.
//$gateway->disableStandalonePlayer();
}
2、访问ByteArray对象出错,修改amfphp\core\amf\io\AMFSerializer.php如下内容:
function writeAmf3ByteArray($d)
{
$this->writeByte(0x0C);
//$this->writeAmf3String($d, true);
$this->writeAmf3ByteArrayBody($d);
}
另需要在写PHP代码时,将AMFPHP的AMF设置为AMF3,Flash设置无效的,代码为$GLOBALS['amfphp']['encoding'] = 'amf3';
或修改amfphp\core\shared\app\Globals.php内容中的$amfphp['encoding'] = "amf0";为$amfphp['encoding'] = "amf3";