如何从PHP中的数组中提取的确切数据 [英] how to extract the exact data from an array in php

查看:110
本文介绍了如何从PHP中的数组中提取的确切数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到了从数据库这个数组...如何得到确切的价值属性......

 阵列

    [0] => TRowResult对象
        (
            [行] =>测试
            [列] =>排列
                (
                    [a21ha:link_0] => T细胞对象
                        (
                            [值] => testsample
                            [时间戳] => 1265010584060
                        )                    [a21ha:LINK_1] => T细胞对象
                        (
                            [值] =>例
                            [时间戳] => 1265092697040
                        )                )        )

如何获得[值]独自在PHP


解决方案

 打印$ myArray的[0]  - >列['a21ha:link_0']  - >价值;

这会给你的第一个。要获得所有,你就必须通过内容的循环。

 的foreach($ myArray的[0]  - >作为$列列){
  打印$ column->价值;
}

i got this array from an database...how to get the exact value attribute......

Array
(
    [0] => TRowResult Object
        (
            [row] => tests
            [columns] => Array
                (
                    [a21ha:link_0] => TCell Object
                        (
                            [value] =>testsample
                            [timestamp] => 1265010584060
                        )

                    [a21ha:link_1] => TCell Object
                        (
                            [value] => example
                            [timestamp] => 1265092697040
                        )

                )

        )

how to get the [value] alone in php

解决方案

print $myArray[0]->columns['a21ha:link_0']->value;

This would give you the first. To get all, you'd have to loop through the contents.

foreach ($myArray[0]->columns as $column) {
  print $column->value;
}

这篇关于如何从PHP中的数组中提取的确切数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆