amfphp 多维数组

发布于 2024-08-21 23:51:40 字数 705 浏览 2 评论 0原文

在我的 Flex 应用程序中,我有一个二维数组,如下所示:

arr[0][0] = "11";
arr[0][1] = "12";

arr[1][0] = "21";
arr[1][1] = "22";

我正在将此数组发送到我的网络服务:

amfWebService.doSomethingWithThatArray(arr);

我正在使用警报检查函数的结果(作为字符串)。

现在我的问题是:PHP 无法正确识别数组。

为了看看 PHP 收到了什么,我实现了这个:

if(is_array($arr))
    if(is_array($arr[0]))
        if(is_array($arr[0][0]))
            return "this can't be true";
        else
            return "no 3 dimensions";
    else
        return "no 2 dimensions";
else
    return "no array";

现在你猜怎么着!我的警报显示“这不可能是真的”,这意味着 arr[0][0] 被识别为数组,而不是它应该被识别为“11”。

有人知道这是关于什么的吗?它的 AMFPHP 1.9 和 Flex 3

in my Flex App, I have a 2-dimensional Array, something like this:

arr[0][0] = "11";
arr[0][1] = "12";

arr[1][0] = "21";
arr[1][1] = "22";

I'm sending this array to my webservice:

amfWebService.doSomethingWithThatArray(arr);

I'm checking the result of the function (which is as string) with an Alert.

Now to my problem: PHP somehow does not recognize the array properly.

To see whats arriving at PHP I've implemented this:

if(is_array($arr))
    if(is_array($arr[0]))
        if(is_array($arr[0][0]))
            return "this can't be true";
        else
            return "no 3 dimensions";
    else
        return "no 2 dimensions";
else
    return "no array";

Now guess what! My Alert shows me "this can't be true", which means that arr[0][0] is recognized as an array and not as "11", which it should.

Anyone has an idea what this is about? Its AMFPHP 1.9 and Flex 3

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

瑶笙 2024-08-28 23:51:40

您可以使用 print_r() 来显示结构或 $arr。发现此类问题的最方便方法是使用适当的调试器之后。

You could have used print_r() to display the structure or $arr. Most convenient way to find such problems - after using a proper debugger.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文