【发布时间】:2017-10-07 07:04:18
【问题描述】:
我有这个数组
//this is onw part of `$pins['location']`
array(9) {
["address"]=> string(23) "11xxx Hudderfield xxxxxx"
["city"]=> string(12) "Jxxxxxx"
["houseNumber"]=> string(5) "11xxx"
["id"]=> NULL
["state"]=> string(2) "xx"
["country"]=> NULL
["street"]=> string(17) "Hudderfield xxxxx"
["unit"]=> NULL
["zip"]=> string(5) "xxxx"
}
错误:
运行代码时它在一个更大的数组中,我收到错误警告:第 77 行 /home/../../../cron.php 中的非法字符串偏移“地址”
76 foreach ($pins['location'] as $pin_lo) {
77 $location_address = $pin_lo['address'];
78 echo $location_address;
79 $location_city = $pin_lo['city'];
80 echo $location_city;
81 }
如您所见,我需要能够将数组值传递给变量。如果我 dd($pins['location']);它以字符串形式显示所有内容
【问题讨论】: