Skip to content

webberwong/PHP-KindEditor-File-Manage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP KindEditor 编辑器文件管理类

用于编辑器浏览文件/图片的功能;管理后台上传文件,如图片;

程序使用

代码示例:(可查看tests/testAssets)

<?php
    //网站根目录,绝对位置,这个绝对位置一定要将windows的路径分隔符 '\' 转为 '/' 才能正常使用
    $siteRoot  = str_replace('\\','/',realpath(dirname(__DIR__))) . '/';
    //网站URL根目录,相对于域名,如果没有子目录,则留空
    $urlRoot   = '';
    //设置的文件根目录,比如Image在/upload/images
    $rootPath  = $siteRoot . 'testAssets/images';
    $kem = new KindEditorImageFileManage($siteRoot,$urlRoot,$rootPath);
    
    //设置浏览路径,即前端浏览到的目录路径,相对于设置文件根目录
    $kem->setVisitDirPath('/');
    //获取前端需要的数据,数组格式
    $result = $kem->getResult(true)
    //前端需要的数据为json的字符串,由使用该类的进行转换并输出
    //echo json_encode($result); 
?>

单元测试

#cmd run
cd tests
phpunit --bootstrap bootstrap.php targetTestFile.php

About

KindEditor 编辑器 php 后端文件管理类,用于浏览文件/图片的管理类

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages