如何从php中的数组获取特定值?

时间:2018-10-04 13:34:36

标签: php arrays

我想获取“ url”的值。我怎样才能做到这一点?请帮忙!谢谢。

Array(
        [value] => Array
            (
         [url] => http://localhost/azmith/wp-content/uploads/2018/10/hero-img.jpg
               ) )

完整的数组如下:

    <?php

       Array(
                ["ID"] => 55,
                ["key"] => "field_5bb500e3e1d6a",
                ["label"] => "Main Banner Image",
                ["type"] => "image",
                ["value"] => Array
(
                        ["ID"] => 63,
                        ["title"] => "hero-img",
                        ["filename"] => "hero-img.jpg",
                        ["url"] => "http://localhost/azmith/wp-content/uploads/2018/10/hero-img.jpg",
                    ),
            );

    ?>

1 个答案:

答案 0 :(得分:-1)

尝试一下

$ url = $ yourArrayName ['value'] ['url'];