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

admin4年前前端技术937

设置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下载


相关文章

javascript获取cookie

//获取cookie function getcooki(name) { var name=name+"="; var mine=do...

jquery 生成的dom无法触发click事件的解决方案

原因是程序找不到此节点在jQuery中有“向未来的元素添加事件处理程序”方法说明,也正是动态创建元素无法触发事件的原因所在。正确的写法应该是:$(‘父元素’).on(‘click’,’动态的子元素’,...

ueditor在php环境实现绝对路径存储,实现cookie指定目录,加域名前缀,实现了独立部署图片站点的功能完成,可以实现完全静态化的操作,大大提高服务器的安全性

ueditor在php环境实现绝对路径存储,实现cookie指定目录,加域名前缀,实现了独立部署图片站点的功能完成,可以实现完全静态化的操作,大大提高服务器的安全性

ueditor在php环境实现绝对路径存储,加域名前缀,实现了独立部署图片站点的功能完成,可以实现完全静态化的操作,大大提高服务器的安全性重点修改部位php/config.json  的11...

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

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

Navigate down the menu through jquery development

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

H5页面移动端双击屏幕禁止页面放大

在meta标签中加入user-scalable=no属性...

发表评论    

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