假设我有一个类似的形状
$something = shape(
'some_key' => ...,
'another_key' => ...,
...
);
如何迭代形状的每个字段?我在找类似的东西
foreach ($something as $key) {
...
}
先用内置的HHShapes::toDict
转换为dict
,然后迭代:
foreach(HHShapes::toDict($something) as $k => $v) {
// ...
}