PHP里如何解析flex中的arraycollection数据类型 20

这种数据类型我在PHP里接收后自动判断为string,如何让它变成xml或者数组一类方便编辑的数据啊?能给我个实例么?或者给我下你的QQ教教我... 这种数据类型我在PHP里接收后自动判断为string,如何让它变成xml或者数组一类方便编辑的数据啊?
能给我个实例么?或者给我下你的QQ教教我
展开
 我来答
see7di
2014-10-26 · TA获得超过299个赞
知道小有建树答主
回答量:793
采纳率:0%
帮助的人:391万
展开全部
Actually, you can create an ArrayCollection type on the PHP side and send native ArrayCollection objects directly over AMF.
Here is some php code I have that works. Save this in a file called
ArrayCollection.php
<?php
class ArrayCollection {
public function getASClassName()
{
return 'flex.messaging.io.ArrayCollection';
}

var $source = array();

function ArrayCollection()
{
$this->source = array();
}
}

To use this on the php side include the ArrayCollection.php in your php project and the syntax to call it looks something like this:
$myArrayCollection = new ArrayCollection();

and if you want to access the array that composes the ArrayCollection you can do this
$someArray = $myArrayCollection->source;

On the Flex side you can pass Array Collections directly to the server over Zend AMF. In one of my projects I have many value objects that have ArrayCollections in them and they work just fine on the PHP side. So it can be done.
If you absolutely can't get the ArrayCollection working in PHP you can just access the array as the "source" property of the ArrayCollection in Actionscript. The code looks something like this in actionscript:
import mx.collections.ArrayCollection;

public var myAC:ArrayCollection = new ArrayCollection();

public var myArray:Array = new Array();

// populate your ArrayCollection with data...

myArray = myAC.source;

myArray will now be an Array of the objects in the ArrayCollection myAC.
Hope this helps. If you have further questions and/or have a code sample let me know.
It took me a bit to figure this one out too.
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
飘然又柔滑的宝贝x
2014-08-15 · TA获得超过742个赞
知道小有建树答主
回答量:902
采纳率:50%
帮助的人:400万
展开全部
arraycollection或者Array 是可以在JS里面接收和遍历的。你可以用JSON进行转化,这样PHP就可以接收了。
追问
你好能,加我Q么?1227和01687,帮我解析下,我送你吃零食好伐~或者我加你也可以,但是你得给我,我网上搜JAVASCRIPT关于arraycollection的没有什么资料啊
本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式