PHP code example of zhuzhichao / umeditor
1. Go to this page and download the library: Download zhuzhichao/umeditor library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
zhuzhichao / umeditor example snippets
'Zhuzhichao\Umeditor\UmeditorServiceProvider',
'Umeditor' => 'Zhuzhichao\Umeditor\Umeditor',
// app/config/packages/zhuzhichao/umeditor/config.php
use Illuminate\Support\Facades\Config;
$url = Config::get('app.url').'/packages/zhuzhichao/umeditor/';
return [
// 图片上传配置
'upload' => [
// 上传图片路径
'savePath' => 'upload/',
// 上传文件大小
'maxSize' => 1000,
// 上传文件类型
'allowFiles' => [".gif" , ".png" , ".jpg" , ".jpeg" , ".bmp"],
],
// 编辑器配置
'editor' => [
// umeditor 根路径
'UMEDITOR_HOME_URL' => $url,
// 图片上传编辑器配置
'imageUrl' => 'umeditor/imageUp',
'imagePath' => '',
'imageFieldName' => 'upfile',
//工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的从新定义
'toolbar' => [
'source | undo redo | bold italic underline strikethrough | superscript subscript | forecolor backcolor | removeformat |',
'insertorderedlist insertunorderedlist | selectall cleardoc paragraph | fontfamily fontsize' ,
'| justifyleft justifycenter justifyright justifyjustify |',
'link unlink | emotion image video | map',
'| horizontal print preview fullscreen', 'drafts', 'formula'
],
// ...
],
];
// 添加css样式
{{ Umeditor::css() }}
// 添加编辑器样式
// 该方法有两个参数,
// 第一个为显示的编辑器内容【可选】
// 第二个为编辑器的attribute数组,可以控制编辑器的id,style,class等内容【可选】,默认id为myEditor
// example: Umeditor::content('', ['id'=>'textid', 'class'=>'text-umeditor'])
// 得到 <script type='text/plain' id='textid' class='text-umeditor'></script>
{{ Umeditor::content() }}
// 添加js
{{ Umeditor::js() }}
shell
php artisan config:publish zhuzhichao/umeditor
shell
php artisan asset:publish zhuzhichao/umeditor