php版给UEditor的图片在线治理栏目增加图片删除功能

WBOY
Release: 2016-06-13 12:01:00
Original
1052 people have browsed it

php版给UEditor的图片在线管理栏目增加图片删除功能

1.找到uedior/dialogs/image/image.js文件,Add为修改部分的代码:

/** * tab点击处理事件 * @param tabHeads * @param tabBodys * @param obj*/function clickHandler(tabHeads, tabBodys, obj) {    //head样式更改    for (var k = 0,    len = tabHeads.length; k <br>找到uedior/php/imageManager.php文件,增加以下内容:<p></p><pre code_snippet_id="411463" snippet_file_name="blog_20140630_2_2324623" name="code" class="php">if ($action == "del") {    $fileName = $_POST['fileName'];    foreach($paths as $path) {        $str1 = delfiles($fileName, $path);        break;    }}function delfiles($fileName, $path, &$files = array()) {    if (!is_dir($path)) return null;    $handle = opendir($path);    while (false !== ($file = readdir($handle))) {        if ($file != '.' && $file != '..') {            $path2 = $path.'/'.$file;            if (is_dir($path2)) {                delfiles($fileName, $path2, $files);            } else {                if (preg_match("/\.(gif|jpeg|jpg|png|bmp)$/i", $file)) {                    $path3 = str_replace('../../', '/static/', $path2);                    $fileImg = basename($path3);                    if ($fileImg == $fileName) {                        $is_del = unlink($path2);                    }                }            }        }    }}
Copy after login





Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template