YII2下使用百度编辑器扩展yii2-ueditor

<span style="font-size:18px;color:#ff0000;"><strong>yii2-ueditor的安装</strong></span>


Yii2是使用composer来管理扩展的

Composer地址:

https://packagist.org/packages/wenyuan/yii2-ueditor

Git 地址:

https://github.com/liucunzhou/yii2-ueditor 

composer如果是在path中的话可以直接

composer require --prefer-dist wenyuan/yii2-ueditor "*"


如果不想使用composer来管理扩展的话,也可以直接修改vendor/composer/autoload_psr4.php

前提是源码目录vendor/wenyuan/yii2-ueditor/源码

return array(

// 添加下面的代码

'wenyuan\\ueditor\\' => array($vendorDir . '/wenyuan/yii2-ueditor')

);


yii2-ueditor的使用

单个百度编辑器的使用

use wenyuan\ueditor\Ueditor;
echo Ueditor::widget(['id'=>'newstext1']);

多个编辑器的使用

use wenyuan\ueditor\Ueditor;
echo Ueditor::widget(['id'=>'newstext1']);
echo Ueditor::widget(['id'=>'newstext2']);

自定义编辑器功能模块

use wenyuan\ueditor\Ueditor;

echo Ueditor::widget(
[
'id'=>'newstext1', 
'options' => [
'toolbars' => [
['fullscreen', 'source', 'undo', 'redo', 'bold'],
],
'autoHeightEnabled' => true,
'autoFloadEnabled' => true
]
]
);


其中id的作用

<script type="text/plain" id="newstext1" name="newstext1"></script>


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值