【发布时间】:2015-12-13 19:39:47
【问题描述】:
我想用 type 的键来回显数组值,这是我的代码,
foreach ($sam as $key => $sa) {
foreach ($sa as $s) {
echo $s['type'];
}
}
这是数组$sam的内容
array (size=1)
0 =>
array (size=5)
'type' => string 'days' (length=4)
'bookable' => string 'no' (length=2)
'priority' => int 10
'from' => string '1' (length=1)
'to' => string '1' (length=1)
我的 foreach 代码结果系列 警告:非法字符串偏移 'type' 我不知道为什么?你能帮我回声type吗谢谢。
【问题讨论】:
标签: php multidimensional-array