ubbedit实现遍历绝对目录绑定cookie查询以前上传的图片

admin4年前前端技术975

设置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;
}

action_list.php文件下载


完整精简配置好的UBB下载


相关文章

Navigate down the menu through jquery development

The core knowledge is to use jquery's hover method to achieve, The animation effe...

whatsapp浮动按钮

whatsapp浮动按钮

whatsapp浮动按钮whatsapp.zip...

原生javascrip 复制功能

兼容chrome FIrfox IE 下载地址000.zip代码如下:<!DOCTYPE html> <html> <head> &nbs...

jquery默认设置第一个类的css或者属性

var me=$("#cima>input");me.eq(0).css...

Jquery中获取自定义标签data-id的值的几种常见方式

https://segmentfault.com/a/1190000005770912里面讲的很详尽了,在此就是总结一下做个笔记加深一下印象 。假如<div id="a&qu...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。