如果我从 Zend_Amf 向 Flex 发送远程数据,如果对象上的两个数组属性具有相同的数据值,则它们在远程端使用相同的内存存储进行反序列化。
示例:AS3 对象:
片段:
[RemoteClass(alias="TestVO")]
public class TestVO
{
public var test1:Array;
public var test2:Array;
}
当它从 Zend_Amf 服务器接收远程数据时,如果数组数据相同,它会为两个数组分配相同的存储空间。
例如:从我发送的远程(ZendAMF)对象:
$this->test1 = array("foo", "bar");
$this->test2 = array("foo", "bar");
当我在 Flex 调试器中调试 TestVO 对象时,我得到:
test1 数组(@597d779)
test2 数组(@597d779)
即:它们引用相同的数组对象。
如果我从远程服务器发送的 2 个数组的值略有不同:
$this->test1 = array("foo", "bar");
$this->test2 = array("bar", "foo");
在 Flex 调试器中,TestVO 对象现在有两个单独的数组,正如您所期望的:
test1 数组(@54cb7e9)
test2 数组(@54cb741)
AMF 输出看起来不错,它总是为 test1/test2 发送两个单独的值,即使它们具有相同的值,所以我猜这是 Flex 反序列化的方式?
有任何想法吗?谢谢。