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

admin4年前前端技术1153

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

重点修改部位

php/config.json  的11行

    "imageUrlPrefix": "http://images.ubb.com", /* 图片访问路径前缀 */

php/Uploader.class.php   行注释掉307---313,添加

return  "C:/Users/frank/Desktop/website/images.ubb.com".$fullname;

完整代码如下:

 private function getFilePath()
    {
        $fullname = $this->fullName;
        // $rootPath = $_SERVER['DOCUMENT_ROOT'];

        // if (substr($fullname, 0, 1) != '/') {
        //     $fullname = '/' . $fullname;
        // }

       // return $rootPath . $fullname;
    return  "C:/Users/frank/Desktop/website/images.ubb.com".$fullname;
    }


实现cookie:

修改action_upload.php里面的每一行代码:

 "pathFormat" => "/".$user_id.$CONFIG['imagePathFormat'],


 

源代码下载


相关文章

Navigate down the menu through jquery development

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

分享与定时自动跳转

<!DOCTYPE html> <html> <head> <meta charset="utf-8">...

通过jQuery Ajax使用FormData对象上传文件,实现uedito文本编辑器独立上传单个图片的功能

FormData对象,是可以使用一系列的键值对来模拟一个完整的表单,然后使用XMLHttpRequest发送这个"表单"。在 Mozilla Developer ...

让TD 与div自动换行的css方法

word-wrap: break-word;  word-break: break-all; white-space: normal;...

webpack全局安装了,使用命令时却提示安装脚手架

全局安装了webpack ,使用webpack的时候,却有如下的提示One CLI for webpack must be installe...

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

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

发表评论    

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