浏览文章
文章信息
elFinder 只允许删除一个文件,不允许删除目录|Only one file is allowed to be deleted, and no directory is allowed to be deleted
444
Only one file is allowed to be deleted, and no directory is allowed to be deleted
只允许删除一个文件,且不能删除任何目录。
如何使用elFinder的bind绑定。
How to use elFinder bind.
其原理是绑定命令的动作前后。例如:rm命令。在删除之前则rm.pre,删除时rm
示例:
function rmCheck($cmd, $args, $elfinder){
/**@var elFinder $elfinder*/
foreach ($args['targets'] as $target) {
if(is_dir($elfinder->realpath($target))){
die(json_encode(['removed'=>'不允许删除目录!']));
}
}
if(count($args['targets'])>1){
die(json_encode(['removed'=>'不允一次性删除多个文件!']));
}
}
$opts = array(
'bind' => [
'rm.pre' => 'rmCheck'
],
...