我有问题,我有这个代码:
$pass = array_filter($var, function($first){
return $first['Data']['Show'] == true && !empty($first['Data']['Botones']) ? array_filter($first['Data']['Botones'], function($second){
return $second['Visible'] == true;
}) : 1;
});
echo json_encode($pass);
并且第一个array_filter工作,但是数组是多维的,如果我有:
[0] = Array(
"Title" => "Home",
"Show" => true,
"Buttons" => Array(
Array("Title" => "Sub-Home", "Visible" => false),
Array("Title" => "Sub-2-Home", "Visible" => true),
)
)
代码显示子菜单的所有按钮,我该如何解决这个问题?