PHP code example of victorruan / yii2-ueditor

1. Go to this page and download the library: Download victorruan/yii2-ueditor 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/ */

    

victorruan / yii2-ueditor example snippets


class EditorController extends victorruan\ueditor\UEditorController
{
    public function init(){
        parent::init();
        //do something
        //这里可以对扩展的访问权限进行控制
    }
    
    public function actionConfig(){
        //do something
        //这里可以对 config 请求进行自定义响应
    }
    
    // more modify ...
    // 更多的修改
}

    'controllerMap' => [
        'ueditor' => [
            'class' => 'victorruan\ueditor\UEditorController',
        ]
    ],

php composer.phar 

    'controllerMap' => [
        'ueditor' => [
            'class' => 'victorruan\ueditor\UEditorController',
            'thumbnail' => false,//如果将'thumbnail'设置为空,将不生成缩略图。
            'watermark' => [    //默认不生存水印
                'path' => '', //水印图片路径
                'position' => 9 //position in [1, 9],表示从左上到右下的 9 个位置,即如1表示左上,5表示中间,9表示右下。
            ],
            'zoom' => ['height' => 500, 'width' => 500], //缩放,默认不缩放
            'config' => [
                //server config @see http://fex-team.github.io/ueditor/#server-config
                'imagePathFormat' => '/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}',
                'scrawlPathFormat' => '/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}',
                'snapscreenPathFormat' => '/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}',
                'catcherPathFormat' => '/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}',
                'videoPathFormat' => '/upload/video/{yyyy}{mm}{dd}/{time}{rand:6}',
                'filePathFormat' => '/upload/file/{yyyy}{mm}{dd}/{rand:4}_{filename}',
                'imageManagerListPath' => '/upload/image/',
                'fileManagerListPath' => '/upload/file/',
            ]
        ]
    ],

<?= \victorruan\ueditor\UEditor::widget([
    'model' => $model,
    'attribute' => 'content',
]) 

<?= \victorruan\ueditor\UEditor::widget([
    'name' => $name,
    'value' => $value,
])