PHP code example of flywi / yii2-ueditor

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

    

flywi / yii2-ueditor example snippets


    'modules' => [
        ....
               'editor' => [
                   'class' => \Flywi\Editor\module\Module::class,
                   'actionMap' => [
                      'uploadimage' => function(\yii\web\UploadedFile $file ,$config){
                         ...
                      }
                   ],
                   'editorConfig' => [
                       "imageActionName" => "uploadimage", /* 执行上传图片的action名称 */
                       "imageFieldName" => "upfileimage", /* 提交的图片表单名称 */
                       // 其他Ueditor后端配置
                   ],
               ]
    ],

...
echo $form->field($model, 'content')->widget(\Flywi\Editor\UEditor::class, [
    'id' => 'contentID',
    'config' => [
      // Ueditor的部分配置
      'serverUrl' => Url:to('..editor') // 对应于modules中editor的url
    ]
]);
...

...
echo \Flywi\Editor\UEditor::widget([
        'name' => 'inputName',
        'id' => 'contentId',
        'config' => [
           // Ueditor的部分配置
             'serverUrl' => Url:to('..editor') // 对应于modules中editor的url
        ]
 ]);
...