我正在尝试从多维数组中获取此数据[label] => For Rent
。这是我的数组
Array ( [listing_id] => 0
[fields] =>
Array ( [1] => Property House 7 [2] => 30 [4] => sdfasd
[11] => Bungalow [10] => Philippines [12] => 1800100
[13] => 1 [14] => 1 [15] => Yes [16] => Yes [17] => Yes
[18] => Yes [26] => Yes [25] => Yes [24] => Yes
[23] => Yes [22] => Yes [21] => Yes [20] => Yes [19] => Yes)
[fees] => Array (
[30] => stdClass Object ( [id] => 2 [label] => For Rent [amount] => 0.00
[days] => 7 [images] => 0
[categories] =>
Array ( [all] => 0
[categories] => Array ( [0] => 30 ) ) [extra_data] => ) )
[images] => Array ( ) [thumbnail_id] => 0 )
如何使用PHP代码回显值label
的{{1}}
答案 0 :(得分:1)
尝试
$array[fees][30]->label
$array
无论你是顶级变量是什么。
答案 1 :(得分:1)
echo $yourArray['fees'][30]->label
它不仅仅是一个数组......它是一个包含对象的数组。使用->
访问对象属性。
答案 2 :(得分:0)
您可以通过键访问任何数组值。只需像这样访问For Rent
: -
echo $arrayName['fees'][30]->label
这将显示For Rent like(一个箭头操作符,因为要访问一个对象属性,你必须使用它)