yii2 使用ueditor教程

1、方法一

php composer.phar require --prefer-dist wenyuan/yii2-ueditor "*"


2、方法二

 
  
① 下载yii2-ueditor : https://github.com/liucunzhou/yii2-ueditor。
   解压到 vendor/wenyuan/yii2-ueditor/下,也就是说,vendor/wenyuan/yii2-ueditor/下的文件如下
composer.json的"require"添加:
    "require": {
        //添加部分
        "wenyuan/yii2-ueditor": "*",
    },

// autoload_psr4.php @generated by Composer


$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);


③vendor/composer/autoload_psr4.php 文件添加: "wenyuan\\ueditor\\" => array($vendorDir . '/wenyuan/yii2-ueditor'),
也就是,vendor/composer/autoload_psr4.php如下
 array($vendorDir . '/yiisoft/yii2-swiftmailer'),
    'yii\\gii\\' => array($vendorDir . '/yiisoft/yii2-gii'),
    'yii\\faker\\' => array($vendorDir . '/yiisoft/yii2-faker'),
    'yii\\debug\\' => array($vendorDir . '/yiisoft/yii2-debug'),
    'yii\\composer\\' => array($vendorDir . '/yiisoft/yii2-composer'),
    'yii\\codeception\\' => array($vendorDir . '/yiisoft/yii2-codeception'),
    'yii\\bootstrap\\' => array($vendorDir . '/yiisoft/yii2-bootstrap'),
    'yii\\' => array($vendorDir . '/yiisoft/yii2'),
    'rmrevin\\yii\\fontawesome\\' => array($vendorDir . '/rmrevin/yii2-fontawesome'),
    'dmstr\\' => array($vendorDir . '/dmstr/yii2-adminlte-asset'),
    'cebe\\markdown\\' => array($vendorDir . '/cebe/markdown'),
   //添加部分
    "wenyuan\\ueditor\\" => array($vendorDir . '/wenyuan/yii2-ueditor'),
);


3、测试

//测试一
'username']);
?>

//测试二


        field($model, 'username')->widget(         Ueditor::className(), ['id'=> 'Doctor[docDetail]', 'ucontent'=>$form->field($model, 'username')->model->username]     );?>    

你可能感兴趣的:(PHP)