function get_editor($name, $value = "", $config = array(), $events = array()){//生成编辑器代码
include_once(SITE_ROOT. 'editor/ckeditor.php');
include_once(SITE_ROOT. 'admin/ckfinder/ckfinder.php');
$ckeditor = new CKEditor();
$ckeditor->basePath = SITE_URL. '/editor/';
$ckfinder = new CKFinder();
$ckfinder->BasePath = '../admin/ckfinder/'; // Note: the BasePath property in the CKFinder class starts with a capital letter.会自动在前面加上/,所以这里不能使用绝对路径
$ckfinder->SetupCKEditorObject($ckeditor);
$ckeditor->returnOutput = true;//启用返回代码方式不是直接echo
return $ckeditor->editor($name, $value, $config, $events);
}
ckfinder/config.php
function CheckAuthentication()
{//需要修改这里,返回直,就允许操作管理页面
// WARNING : DO NOT simply return "true". By doing so, you are allowing
// "anyone" to upload and list the files in your server. You must implement
// some kind of session validation here. Even something very simple as...
// return isset($_SESSION['IsAuthorized']) && $_SESSION['IsAuthorized'];
// ... where $_SESSION['IsAuthorized'] is set to "true" as soon as the
// user logs in your system. To be able to use session variables don't
// forget to add session_start() at the top of this file.
return !( empty($_COOKIE['site_code']) || empty($_COOKIE['sitecookie_id']) );//未登录,不允许管理文件,返回false
}$config['FilesystemEncoding'] = 'gb2312';//系统编码,防止中文文件名乱码
$config['ForceAscii'] = true;//把多字节转成ascii
$baseUrl = './uploads/ckfinder/';//./相对于域名根目录
上传图片时出现的提示:
由于文件系统的限制,该请求不能完成
自动创建的文件夹没有写入的权限,但是修改名字却又能成功;奇怪的现象,没找源码,看了一下配置,已经没有什么可修改了.
手动创建文件夹后却能正常上传
使用xp测试