xinyeweb/yii2-ueditor

yii2-ueditor

安装: 50

依赖: 0

建议者: 0

安全: 0

星标: 1

关注者: 3

分支: 0

开放问题: 0

语言:JavaScript

类型:yii2-extension

dev-master 2016-05-09 06:29 UTC

This package is auto-updated.

Last update: 2024-09-16 20:09:17 UTC


README

yii2-ueditor

安装

安装此扩展的首选方式是通过composer

运行以下命令之一

php composer.phar require --prefer-dist xinyeweb/yii2-ueditor:dev-master

或者在您的composer.json文件的require部分添加

"xinyeweb/yii2-ueditor": "dev-master"

to

使用

一旦安装了此扩展,只需在您的代码中使用它即可

public function actions()
{
    return [
        'upload' => [
            'class' => 'xinyeweb\ueditor\UEditorAction',
            'config' => [
                'imageRoot' => dirname(\Yii::$app->basePath).dirname(\Yii::getAlias('@web')). DIRECTORY_SEPARATOR . 'images_webroot',//圖片的根路径
                //'imageUrlPrefix' => 'http://www.baidu.com',
                //'imagePathFormat' =>  dirname(Yii::$app->basePath)."/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}" ,
            ]
        ]
    ];
}

使用:

<?= $form->field($model, 'description')->widget('\xinyeweb\ueditor\UEditor',[]) ?>