对不起,我不知道如何真正措辞这个问题。我有一个应用程序,您可以在其中指定要对某些用户隐藏的文件类型,如下所示:
$config['app']['custom_hidden_files']['users']['108'] = array("*.ftpquota", "*.FTPQUOTA");
上面的行将隐藏用户#108的所有.ftpquota文件。我正在尝试对所有用户隐藏文件类型。我试过:
$config['app']['custom_hidden_files']['users'][''] = array("*.ftpquota", "*.FTPQUOTA");
$config['app']['custom_hidden_files']['users'][] = array("*.ftpquota", "*.FTPQUOTA");
$config['app']['custom_hidden_files']['users']['*'] = array("*.ftpquota", "*.FTPQUOTA");
$config['app']['custom_hidden_files']['users'][*] = array("*.ftpquota", "*.FTPQUOTA");
$config['app']['custom_hidden_files']['users'] = array("*.ftpquota", "*.FTPQUOTA");
有人知道我如何指定所有用户吗?
由于您不知道数组的所有 indeces 是什么,因此您可以遍历所有值并使用 foreach 将它们全部设置为所需的值。
foreach($config['app']['custom_hidden_files']['users'] as $index => $value)
{
$config['app']['custom_hidden_files']['users'][$index] = Array("*.ftpquota", "*.FTPQUOTA");
}
foreach ($config['app']['custom_hidden_files']['users'] as $user)
{
$user=array("*.ftpquota", "*.FTPQUOTA");
}