### 1、umeditor 配置文件修改 修改 umeditor.config.js 配置文件 ``` ,imageUrl:URL+"php/imageUp.php" //图片上传提交地址 ,imagePath:URL + "php/" //图片修正地址,引用了fixedImagePath,如有特殊需求,可自行配置 ,imageFieldName:"upfile" ``` 为 ``` //图片上传配置区 ,imageUrl:"/backend/index/uploadUmeditor" //图片上传提交地址 ,imagePath:"" //图片修正地址,引用了fixedImagePath,如有特殊需求,可自行配置 ,imageFieldName:"upfile" ``` ### 2、服务端文件处理 ``` /** * 百度富文本图片上传 */ public function uploadUmeditor() { $action = $this->request->param('editorid'); switch ($action) { case 'config': $result = file_get_contents(Env::get('root_path') . 'public/static/js/ueditor/config.json'); break; case 'content': $file = $this->request->file('upfile'); $response = ['state' => 'SUCCESS', 'url' => '']; if ($file) { // 上传到本地 $info = $file->move(Env::get('root_path') . 'public' . DIRECTORY_SEPARATOR . 'upload'); if ($info) $response['url'] = '/upload/' . $info->getSaveName(); // 上传到阿里云 // $res = AliYunOss::uploadFile($file->getInfo()['tmp_name'], pathinfo($file->getInfo()['name'])['extension']); // if ($res['code'] == 0) $response['url'] = $res['url']; } $result = json_encode($response); break; default: break; } return $result; } ```