我需要从嵌套在数组中的值中捕获变量,但我无法弄清楚指定该值位置的语法。print_r($result_array) 输出以下数组...我想捕捉“这个值在这里!” 在一个变量中。$var = $result_array['order'] /// 然后呢???Array( [order] => Array ( [line_items] => Array ( [0] => Array ( [catalog_object_id] => This value here! [quantity] => 1 ) ) [fulfillments] => Array ( [0] => Array ( [state] => PROPOSED [type] => PICKUP [pickup_details] => Array ( [is_curbside_pickup] => 1 [pickup_at] => 2020-05-20 05:09:02 [recipient] => Array ( [display_name] => John ) ) ) ) ))
1 回答
不负相思意
TA贡献1777条经验 获得超10个赞
$var = $result_array['order']['line_items'][0]['catalog_object_id']
对此不应有任何混淆。你正在遍历一个数组,所以你只需要在每个数组下选择正确的元素。
- 1 回答
- 0 关注
- 77 浏览
添加回答
举报
0/150
提交
取消