百度的都尝试过了,对我没有用
时间有限,简单改了一下部分功能,大部分功能是可以用的,我重新改了一下
打开ueditor本目录下的ueditor.confin.js将serverUrl修改为您的上传接口(大约在33行左右)
serverUrl: "/back/common/ueditor_upload"
在后台简单写了一下代码
/**
* 文件上传
*/
public function ueditor_upload(){
$action = $this->request->param('action');
$CONFIG = json_decode(preg_replace("/\/\*[\s\S]+?\*\//", "", file_get_contents(ROOT_PATH.'/static/admin/lib/ueditor/1.4.3/php/config.json')), true);
switch($action){
case 'config':
$result = json_encode($CONFIG);
break;
case 'uploadimage':
$file = $this->request->file('upfile');
if($file){
$info = $file->move(ROOT_PATH . 'public' . DS . 'uploads' . DS .'ueditor');
$res = $info->getInfo();
$res['state'] = 'SUCCESS';
$res['url'] = ROOT_PATH . 'public' . DS . 'uploads' . DS .'ueditor'. DS .$info->getSaveName();
$result = json_encode($res);
}
break;
case 'uploadvideo':
$file = $this->request->file('upfile');
if($file){
$info = $file->move(ROOT_PATH . 'public' . DS . 'uploads' . DS .'ueditor');
$res = $info->getInfo();
$res['state'] = 'SUCCESS';
$res['url'] = ROOT_PATH . 'public' . DS . 'uploads' . DS .'ueditor'. DS .$info->getSaveName();
$result = json_encode($res);
}
break;
case 'uploadfile':
$file = $this->request->file('upfile');
if($file){
$info = $file->move(ROOT_PATH . 'public' . DS . 'uploads' . DS .'ueditor');
$res = $info->getInfo();
$res['state'] = 'SUCCESS';
$res['url'] = ROOT_PATH . 'public' . DS . 'uploads' . DS .'ueditor'. DS .$info->getSaveName();
$result = json_encode($res);
}
break;
/* 列出图片 */
case 'listimage':
$result = include(ROOT_PATH."/static/admin/lib/ueditor/1.4.3/php/action_list.php");
break;
/* 列出文件 */
case 'listfile':
$result = include(ROOT_PATH."/static/admin/lib/ueditor/1.4.3/php/action_list.php");
break;
/* 抓取远程文件 */
case 'catchimage':
$result = include(ROOT_PATH."/static/admin/lib/ueditor/1.4.3/php/action_crawler.php");
default:
break;
}
return $result;
}
上面代码include的文件路径可能会有所不同,自己根据自己下载的ueditor目录决定
弄好以后,刷新一下页面