在您的laravel项目主页中运行命令。
composer require menthe/aliyun-ueditor -vvv
将提供程序行复制到您的config / app.php中
Harris\UEditor\UEditorServiceProvider::class,
然后运行命令。
php artisan vendor:publish
更改配置文件-> config / UEditorUpload.php
在刀片模板文件(例如template.blade.php)中包括该行,您便拥有了ueditor静态文件。
@include('ueditor::head');使用Javascript初始化ueditor。
<!-- 加载编辑器的容器 --><script id="container" name="content" type="text/plain">
这里写你的初始化内容</script><!-- 实例化编辑器 --><script type="text/javascript">
var ue = UE.getEditor('container');
ue.ready(function() {
ue.execCommand('serverparam', '_token', '{{ csrf_token() }}');//此处为支持laravel5 csrf ,根据实际情况修改,目的就是设置 _token 值.
});</script>如果不能使用本地上传。
找到\vendor\menthe\aliyun-ueditor\src\Uploader\UploadFile.php
增加:
if(config('UEditorUpload.core.mode') == 'local') {
if($this->file->move(dirname($this->filePath), $this->fileName)){
$this->stateInfo="SUCCESS";
}else{
$this->stateInfo="ERROR";
}
}