求助,yii2加载ckeditor抛出Invalid Parameter异常。 [ 2.0 版本 ]
在加载kartik\detail\DetailView
时,开启ckeditor后,出现下面异常:
Invalid Parameter – yii\base\InvalidParamException
Trying to copy a directory to itself or a subdirectory.
看了下,问题可能出在下面的第2条:
BaseFileHelper::copyDirectory('/Users/qijiaona/var/www/intel/backend/web/assets', '/Users/qijiaona/var/www/intel/backend/web/assets/da31e3d5');
关闭ckeditor插件后就可以正常运行了。
求解决。
1. in /Users/qijiaona/var/www/intel/vendor/yiisoft/yii2/helpers/BaseFileHelper.php at line 260
2. in /Users/qijiaona/var/www/intel/vendor/yiisoft/yii2/web/AssetManager.php at line 542 – yii\helpers\BaseFileHelper::copyDirectory('/Users/qijiaona/var/www/intel/ba...', '/Users/qijiaona/var/www/intel/ba...', ['dirMode' => 509, 'fileMode' => null, 'beforeCopy' => Closure])
3. in /Users/qijiaona/var/www/intel/vendor/yiisoft/yii2/web/AssetManager.php at line 458 – yii\web\AssetManager::publishDirectory('/Users/qijiaona/var/www/intel/ba...', [])
4. in /Users/qijiaona/var/www/intel/vendor/yiisoft/yii2/web/AssetBundle.php at line 183 – yii\web\AssetManager::publish('assets', [])
5. in /Users/qijiaona/var/www/intel/vendor/yiisoft/yii2/web/AssetManager.php at line 266 – yii\web\AssetBundle::publish(yii\web\AssetManager)
6. in /Users/qijiaona/var/www/intel/vendor/yiisoft/yii2/web/AssetManager.php at line 237 – yii\web\AssetManager::loadBundle('dosamigos\ckeditor\CKEditorWidge...', [], true)
7. in /Users/qijiaona/var/www/intel/vendor/yiisoft/yii2/web/View.php at line 284 – yii\web\AssetManager::getBundle('dosamigos\ckeditor\CKEditorWidge...')
8. in /Users/qijiaona/var/www/intel/vendor/yiisoft/yii2/web/AssetBundle.php at line 123 – yii\web\View::registerAssetBundle('dosamigos\ckeditor\CKEditorWidge...')
9. in /Users/qijiaona/var/www/intel/vendor/2amigos/yii2-ckeditor-widget/src/CKEditor.php at line 57 – yii\web\AssetBundle::register(yii\web\View)
10. in /Users/qijiaona/var/www/intel/vendor/2amigos/yii2-ckeditor-widget/src/CKEditor.php at line 44 – dosamigos\ckeditor\CKEditor::registerPlugin()
11. in /Users/qijiaona/var/www/intel/vendor/yiisoft/yii2/base/Widget.php at line 102 – dosamigos\ckeditor\CKEditor::run()
12. in /Users/qijiaona/var/www/intel/vendor/yiisoft/yii2/widgets/ActiveField.php at line 703 – yii\base\Widget::widget(['preset' => 'full', 'clientOptions' => ['allowedContent' => true, 'extraPlugins' => 'lineheight,uploadimage', 'line_height' => '1;1.2;1.5;2;2.5;3', 'imageUploadUrl' => '/accelerator/upload'], 'model' => common\models\Accelerator, 'attribute' => 'acc_desc_long', ...])
13. in /Users/qijiaona/var/www/intel/vendor/kartik-v/yii2-detail-view/DetailView.php at line 873 – yii\widgets\ActiveField::widget('\dosamigos\ckeditor\CKEditor', ['preset' => 'full', 'clientOptions' => ['allowedContent' => true, 'extraPlugins' => 'lineheight,uploadimage', 'line_height' => '1;1.2;1.5;2;2.5;3', 'imageUploadUrl' => '/accelerator/upload']])
14. in /Users/qijiaona/var/www/intel/vendor/kartik-v/yii2-detail-view/DetailView.php at line 785 – kartik\detail\DetailView::renderFormAttribute(['attribute' => 'acc_desc_long', 'format' => 'raw', 'type' => 'widget', 'widgetOptions' => ['class' => '\dosamigos\ckeditor\CKEditor', 'preset' => 'full', 'clientOptions' => ['allowedContent' => true, 'extraPlugins' => 'lineheight,uploadimage', 'line_height' => '1;1.2;1.5;2;2.5;3', 'imageUploadUrl' => '/accelerator/upload']], ...])
15. in /Users/qijiaona/var/www/intel/vendor/kartik-v/yii2-detail-view/DetailView.php at line 745 – kartik\detail\DetailView::renderAttributeItem(['attribute' => 'acc_desc_long', 'format' => 'raw', 'type' => 'widget', 'widgetOptions' => ['class' => '\dosamigos\ckeditor\CKEditor', 'preset' => 'full', 'clientOptions' => ['allowedContent' => true, 'extraPlugins' => 'lineheight,uploadimage', 'line_height' => '1;1.2;1.5;2;2.5;3', 'imageUploadUrl' => '/accelerator/upload']], ...])
16. in /Users/qijiaona/var/www/intel/vendor/kartik-v/yii2-detail-view/DetailView.php at line 718 – kartik\detail\DetailView::renderAttributeRow(['attribute' => 'acc_desc_long', 'format' => 'raw', 'type' => 'widget', 'widgetOptions' => ['class' => '\dosamigos\ckeditor\CKEditor', 'preset' => 'full', 'clientOptions' => ['allowedContent' => true, 'extraPlugins' => 'lineheight,uploadimage', 'line_height' => '1;1.2;1.5;2;2.5;3', 'imageUploadUrl' => '/accelerator/upload']], ...])
17. in /Users/qijiaona/var/www/intel/vendor/kartik-v/yii2-detail-view/DetailView.php at line 611 – kartik\detail\DetailView::renderDetailView()
18. in /Users/qijiaona/var/www/intel/vendor/kartik-v/yii2-detail-view/DetailView.php at line 548 – kartik\detail\DetailView::runWidget()
19. in /Users/qijiaona/var/www/intel/vendor/yiisoft/yii2/base/Widget.php at line 102 – kartik\detail\DetailView::run()
20. in /Users/qijiaona/var/www/intel/backend/views/accelerator/view.php at line 176 – yii\base\Widget::widget(['model' => common\models\Accelerator, 'mode' => 'view', 'formOptions' => ['options' => ['enctype' => 'multipart/form-data']], 'panel' => ['heading' => '众创空间详情', 'type' => 'primary'], ...])
21. in /Users/qijiaona/var/www/intel/vendor/yiisoft/yii2/base/View.php at line 326 – require('/Users/qijiaona/var/www/intel/ba...')
22. in /Users/qijiaona/var/www/intel/vendor/yiisoft/yii2/base/View.php at line 248 – yii\base\View::renderPhpFile('/Users/qijiaona/var/www/intel/ba...', ['model' => common\models\Accelerator, 'dataProvider' => yii\data\ActiveDataProvider, 'dpMentor' => yii\data\ActiveDataProvider, 'dpInvestor' => yii\data\ActiveDataProvider, ...])
23. in /Users/qijiaona/var/www/intel/vendor/yiisoft/yii2/base/View.php at line 150 – yii\base\View::renderFile('/Users/qijiaona/var/www/intel/ba...', ['model' => common\models\Accelerator, 'dataProvider' => yii\data\ActiveDataProvider, 'dpMentor' => yii\data\ActiveDataProvider, 'dpInvestor' => yii\data\ActiveDataProvider, ...], backend\controllers\AcceleratorController)
24. in /Users/qijiaona/var/www/intel/vendor/yiisoft/yii2/base/Controller.php at line 378 – yii\base\View::render('view', ['model' => common\models\Accelerator, 'dataProvider' => yii\data\ActiveDataProvider, 'dpMentor' => yii\data\ActiveDataProvider, 'dpInvestor' => yii\data\ActiveDataProvider, ...], backend\controllers\AcceleratorController)
25. in /Users/qijiaona/var/www/intel/backend/controllers/AcceleratorController.php at line 189 – yii\base\Controller::render('view', ['model' => common\models\Accelerator, 'dataProvider' => yii\data\ActiveDataProvider, 'dpMentor' => yii\data\ActiveDataProvider, 'dpInvestor' => yii\data\ActiveDataProvider, ...])
26. backend\controllers\AcceleratorController::actionView('58')
27. in /Users/qijiaona/var/www/intel/vendor/yiisoft/yii2/base/InlineAction.php at line 55 – call_user_func_array([backend\controllers\AcceleratorController, 'actionView'], ['58'])
28. in /Users/qijiaona/var/www/intel/vendor/yiisoft/yii2/base/Controller.php at line 154 – yii\base\InlineAction::runWithParams(['r' => 'accelerator/view', 'id' => '58'])
29. in /Users/qijiaona/var/www/intel/vendor/yiisoft/yii2/base/Module.php at line 454 – yii\base\Controller::runAction('view', ['r' => 'accelerator/view', 'id' => '58'])
30. in /Users/qijiaona/var/www/intel/vendor/yiisoft/yii2/web/Application.php at line 100 – yii\base\Module::runAction('accelerator/view', ['r' => 'accelerator/view', 'id' => '58'])
31. in /Users/qijiaona/var/www/intel/vendor/yiisoft/yii2/base/Application.php at line 375 – yii\web\Application::handleRequest(yii\web\Request)
32. in /Users/qijiaona/var/www/intel/backend/web/index.php at line 18 – yii\base\Application::run()
ps: 我看到之前有人也遇到过类似的问题,比如sgmengfault上的这个yii2 Trying to copy a directory to itself or a subdirectory,还有yiichina上的这个创建表单报错 ,但这两个帖子都与我遇到的情况不同,求解决。
我的AppAsset类配置
public $basePath = '@webroot';
public $baseUrl = '@web';
public $css = [
'css/site.css',
];
public $js = [
];
public $depends = [
'yii\web\YiiAsset',
'yii\bootstrap\BootstrapAsset',
];
最佳答案
其他 1 个回答
-
dingjj2010 回答于 2016-10-08 17:20 举报
修改yii2-ckeditor-widget文件夹下面的CKEditorWidgetAsset.php文件
修改public $sourcePath = 'assets';
为
public $sourcePath = '@vendor/ckeditor/ckeditor/assets';
共 1 条回复
yangtoude 北京
注册时间:2016-03-20
最后登录:2017-04-08
在线时长:4小时46分
最后登录:2017-04-08
在线时长:4小时46分
- 粉丝1
- 金钱40
- 威望0
- 积分80