无法从数组中获取值注意:未定义的索引:

时间:2015-10-22 11:30:07

标签: php arrays wordpress

我尝试使用以下内容将post_id设置为变量,但我收到了未定义的索引错误。

$propertyID['post_id']

这是我的var_dump()

array(1) {
  [0]=>
  array(2) {
    ["post_id"]=>
    string(4) "4323"
    ["meta_key"]=>
    string(9) "unique_id"
  }
}

2 个答案:

答案 0 :(得分:1)

您必须使用$propertyID[0]['post_id']

答案 1 :(得分:0)

数组的索引0中的所有值: -

$propertyID[0]['post_id'] //result :- 4323
$propertyID[0]['meta_key'] //result :- unique_id
相关问题