guoguo882010 / ueditor-oss
百度编辑器图片上传到阿里云 oss
1.0.0
2025-08-26 06:16 UTC
Requires
- php: >=7.1
- guoguo882010/aliyun-oss: ^1.0
This package is not auto-updated.
Last update: 2025-09-10 04:49:31 UTC
README
安装
composer require guoguo882010/ueditor-oss
使用
更改百度编辑器的配置文件 ueditor.config.js 中的 serverUrl 为你项目的控制器方法
//阿里云 oss 配置 $ossConfig = [ 'access_key_id' => 'key id', 'access_key_secret' => 'key secret', // 桶名称 'bucket_name' => 'scb-sys', // 阿里外网、内网url,自定义url 'endpoint' => 'http://oss-cn-chengdu.aliyuncs.com', // 临时url超时时间,单位秒 'sign_timeout' => 3600, ]; //百度编辑器,后端图片处理 $baidu = new \RSHDSDK\UEditorOSS\UEditor($ossConfig); //前台接收的百度编辑器 url 参数数组传给 action 方法,自动把图片上传到阿里 oss $baidu->action($this->request->param()); //获取的数据,oss替换成完整路径 $baidu->getHtml('html字符串'); //设置的数据,删除掉oss路径中的域名 $baidu->setHtml('html字符串');