1

我正在互联网上的论坛上研究一些解决方案以向 AmfPHP 发送和 ArrayCollection,但我没有找到好的响应,以及如何访问 PHP 端的数组以包含到 MySQL 表中。

我的问题:

我有一个填充了一些名称和电子邮件的 Flex 数据网格,我想创建一种方法来允许用户创建一个组并选择名称作为该组的一部分。我在 Flash Builder 调试器中看到数据以 ArrayCollection 的形式发送(也从 Vector 转换为 Object),而问题仍然在于如何在 PHP 端访问该数组。

这是发送到 AmfPHP 的 ArrayCollection:

[0] Object (@cf87311)   
[1] Object (@d4bfcb9)   
[2] Object (@d4d3479)   

这是数组的键和值:

[0] Object (@cf87311)   
    id  "2" 
    nome    "David" 
    username    "david" 
[1] Object (@d4bfcb9)   
    id  "3" 
    nome    "jose"  
    username    "jose@jose.com" 
[2] Object (@d4d3479)   
    id  "4" 
    nome    "joao"
    username    "joao@joao.com" 

有谁知道我必须做什么才能访问此数组中的“id”字段?

此致 !

拉斐尔·塔瓦雷斯

4

1 回答 1

1

AMFPHP will translate your actionscript object into a PHP object. Pass the arraycollection as one param. On the PHP side you would use it as:

function myfunction( $Object_param )
{
   foreach( $Object_param as $Object )
   {
       echo $Object[ 'id' ];
       echo $Object[ 'nome' ];
   }
}

and so on.

于 2012-11-25T16:25:45.550 回答