从PHP中的数组中获取值

从PHP中的数组中获取值

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

问题描述

你好我在php中有一个数组,当打印数组时,它似乎是



 数组 

[ 0 ] => 数组

[pageID] => 1
[add] => 1
[查看] => 0
[edit] => 0
[删除] => 0


[ 1 ] => 数组

[pageID] => 3
[add] => 0
[查看] => 1
[edit] => 0
[ delete ] => 0


[ 2 ] => 数组

[pageID] => 4
[ add] => 0
[view] => 0
=> 1
[删除] => 0


[ 3 ] => 数组

[pageID] => 6
[ add] => 0
[view] => 0
=> 0
[删除] => 0






现在我想要价值对于每个内部数组。



我尝试过:



我尝试过使用$ str [0] - > pageID;但它没有返回任何价值。我也试过使用$ str-> pageID [0],但结果是相同的

解决方案




hello I have a array in php, when printing the array it appears to be

Array
(
    [0] => Array
        (
            [pageID] => 1
            [add] => 1
            [view] => 0
            [edit] => 0
            [delete] => 0
        )

    [1] => Array
        (
            [pageID] => 3
            [add] => 0
            [view] => 1
            [edit] => 0
            [delete] => 0
        )

    [2] => Array
        (
            [pageID] => 4
            [add] => 0
            [view] => 0
            [edit] => 1
            [delete] => 0
        )

    [3] => Array
        (
            [pageID] => 6
            [add] => 0
            [view] => 0
            [edit] => 0
            [delete] => 0
        )

)



now i want value for each inside array.

What I have tried:

I have tried using $str[0]->pageID; but its not returning any value. also I have tried using $str->pageID[0] but the result is same

解决方案




这篇关于从PHP中的数组中获取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 20:08