如何在php中使用foreach循环显示多维数组结果

时间:2017-03-31 05:31:55

标签: php arrays foreach

Array
(
    [result] => Array
        (
            [0] => stdClass Object
                (
                    [uniq_id] => 00fdc23c151ad0044d60
                )

            [1] => stdClass Object
                (
                    [uniq_id] => 590dde424e
                )

            [2] => stdClass Object
                (
                    [uniq_id] => 6f0eb3bb34
                )

            [3] => stdClass Object
                (
                    [uniq_id] => eeb6c63929
                )

            [4] => stdClass Object
                (
                    [uniq_id] => a72034387e
                )
                     }
}

但我想在uniq_id循环

中逐个只有多个foreach

00fdc23c151ad0044d60

590dde424e

6f0eb3bb34

eeb6c63929

a72034387e

1 个答案:

答案 0 :(得分:3)

它是stdClass Object array,所以试试这个:

foreach($yourArray['result'] as $data)
{
    echo $date->uniq_id.'<br>';
}

注意: stdClass可以使用properties

访问对象->