ubbedit实现遍历绝对目录绑定cookie查询以前上传的图片
设置cookie ,$user_id=$_COOKIE["user_email"];
设置path , $path = "/".$user_id.$CONFIG['fileManagerListPath'];
获取文件列表: 修改成如下
/* 获取文件列表 */ //$path = $_SERVER['DOCUMENT_ROOT'] . (substr($path, 0, 1) == "/" ? "":"/") . $path; $path = "C:/Users/frank/Desktop/website/images.ubb.com".$path;
遍历获取目录下的指定类型的文件
修改:'url'=> substr($path2, strlen("C:/Users/frank/Desktop/website/images.ubb.com")),
function getfiles($path, $allowFiles, &$files = array())
{
if (!is_dir($path)) return null;
if(substr($path, strlen($path) - 1) != '/') $path .= '/';
$handle = opendir($path);
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..') {
$path2 = $path . $file;
if (is_dir($path2)) {
getfiles($path2, $allowFiles, $files);
} else {
if (preg_match("/\.(".$allowFiles.")$/i", $file)) {
$files[] = array(
'url'=> substr($path2, strlen("C:/Users/frank/Desktop/website/images.ubb.com")),
'mtime'=> filemtime($path2)
);
}
}
}
}
return $files;
}
