e282486518
- e282486518 回复了 qiuch87 的评论
ueditor插件的使用,能不能普及一下,谢谢
controller
` <?php
class BusinessController extends BaseController
{public function actions() { return [ 'upload'=>[ 'class'=>'kucha\ueditor\UEditorAction' ] ]; } public function actionAdd() { $model = $this->findModel(0); if(Yii::$app->request->isPost){ $data = Yii::$app->request->post('Business'); if($this->saveRow($model,$data)){ $this->success('操作成功',$this->getForward()); }else{ $this->error('操作错误'); } } $model->loadDefaultValues(); //$model->pid = Yii::$app->request->get('pid',0); return $this->render('create',[ 'model'=>$model ]); }?>`
views
`<?= $form->field($model, 'content')->widget('kucha\ueditor\UEditor',['clientOptions' => [ 'serverUrl' => Url::to(['public/ueditor']),//确保serverUrl正确指向后端地址 'lang' =>'zh-cn', //中文为 zh-cn 'initialFrameWidth' => '100%', 'initialFrameHeight' => '400', //定制菜单,参考http://fex.baidu.com/ueditor/#start-toolbar 'toolbars' => [ [ 'fullscreen', 'source', 'undo', 'redo', '|', 'fontsize', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', '|', 'lineheight', '|', 'indent', '|', ], ['preview','simpleupload','insertimage','link','emotion','map','insertvideo','insertcode',] ] ]
],['class'=>'c-md-7'])->label('商家介绍'); ?>`
@qiuch87 好像这个很早就有问题了,我这边插件没有升级所以一直没出问题。
- e282486518 回复了 qiuch87 的评论
ueditor插件的使用,能不能普及一下,谢谢
controller
` <?php
class BusinessController extends BaseController
{public function actions() { return [ 'upload'=>[ 'class'=>'kucha\ueditor\UEditorAction' ] ]; } public function actionAdd() { $model = $this->findModel(0); if(Yii::$app->request->isPost){ $data = Yii::$app->request->post('Business'); if($this->saveRow($model,$data)){ $this->success('操作成功',$this->getForward()); }else{ $this->error('操作错误'); } } $model->loadDefaultValues(); //$model->pid = Yii::$app->request->get('pid',0); return $this->render('create',[ 'model'=>$model ]); }?>`
views
`<?= $form->field($model, 'content')->widget('kucha\ueditor\UEditor',['clientOptions' => [ 'serverUrl' => Url::to(['public/ueditor']),//确保serverUrl正确指向后端地址 'lang' =>'zh-cn', //中文为 zh-cn 'initialFrameWidth' => '100%', 'initialFrameHeight' => '400', //定制菜单,参考http://fex.baidu.com/ueditor/#start-toolbar 'toolbars' => [ [ 'fullscreen', 'source', 'undo', 'redo', '|', 'fontsize', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', '|', 'lineheight', '|', 'indent', '|', ], ['preview','simpleupload','insertimage','link','emotion','map','insertvideo','insertcode',] ] ]
],['class'=>'c-md-7'])->label('商家介绍'); ?>`
@qiuch87 已修正,将common\actions\UEditorAction.php的内容清空即可。已上传到GitHub了。
- e282486518 回复了 qiuch87 的评论
ueditor插件的使用,能不能普及一下,谢谢
controller
` <?php
class BusinessController extends BaseController
{public function actions() { return [ 'upload'=>[ 'class'=>'kucha\ueditor\UEditorAction' ] ]; } public function actionAdd() { $model = $this->findModel(0); if(Yii::$app->request->isPost){ $data = Yii::$app->request->post('Business'); if($this->saveRow($model,$data)){ $this->success('操作成功',$this->getForward()); }else{ $this->error('操作错误'); } } $model->loadDefaultValues(); //$model->pid = Yii::$app->request->get('pid',0); return $this->render('create',[ 'model'=>$model ]); }?>`
views
`<?= $form->field($model, 'content')->widget('kucha\ueditor\UEditor',['clientOptions' => [ 'serverUrl' => Url::to(['public/ueditor']),//确保serverUrl正确指向后端地址 'lang' =>'zh-cn', //中文为 zh-cn 'initialFrameWidth' => '100%', 'initialFrameHeight' => '400', //定制菜单,参考http://fex.baidu.com/ueditor/#start-toolbar 'toolbars' => [ [ 'fullscreen', 'source', 'undo', 'redo', '|', 'fontsize', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', '|', 'lineheight', '|', 'indent', '|', ], ['preview','simpleupload','insertimage','link','emotion','map','insertvideo','insertcode',] ] ]
],['class'=>'c-md-7'])->label('商家介绍'); ?>`
嗯,是不能使用了。ueditor插件最新版本和老版本不兼容。等会我升级后在上传
- e282486518 回复了 roc_teng 的评论
An Error occurred while handling another error: exception 'yii\base\InvalidRouteException' with message 'Unable to resolve the request "public/404".' in C:\wampto\www\yii2admin\vendor\yiisoft\yii2\base\Module.php:537 Stack trace: #0 C:\wampto\www\yii2admin\vendor\yiisoft\yii2\web\ErrorHandler.php(97): yii\base\Module->runAction('public/404') #1 C:\wampto\www\yii2admin\vendor\yiisoft\yii2\base\ErrorHandler.php(111): yii\web\ErrorHandler->renderException(Object(yii\web\NotFoundHttpException)) #2 [internal function]: yii\base\ErrorHandler->handleException(Object(yii\web\NotFoundHttpException)) #3 {main} Previous exception: exception 'yii\base\InvalidRouteException' with message 'Unable to resolve the request "yii2admin/web/".' in C:\wampto\www\yii2admin\vendor\yiisoft\yii2\base\Module.php:537 Stack trace: #0 C:\wampto\www\yii2admin\vendor\yiisoft\yii2\web\Application.php(103): yii\base\Module->runAction('yii2admin/web/', Array) #1 C:\wampto\www\yii2admin\vendor\yiisoft\yii2\base\Application.php(386): yii\web\Application->handleRequest(Object(common\core\Request)) #2 C:\wampto\www\yii2admin\web\index.php(24): yii\base\Application->run() #3 {main} Next exception 'yii\web\NotFoundHttpException' with message '页面未找到。' in C:\wampto\www\yii2admin\vendor\yiisoft\yii2\web\Application.php:115 Stack trace: #0 C:\wampto\www\yii2admin\vendor\yiisoft\yii2\base\Application.php(386): yii\web\Application->handleRequest(Object(common\core\Request)) #1 C:\wampto\www\yii2admin\web\index.php(24): yii\base\Application->run() #2 {main}
求助下楼主,怎么解决
应该是没配置重写,导致的404错误
- e282486518 回复了 pengcx 的评论
Fatal error: Class 'Dotenv\Dotenv' not found in D:\www\yii2admin\common\env.php on line 65
应该是没有安装"vlucas/phpdotenv"扩展,查看vendor目录中是否有这个扩展
- e282486518 回复了 felix_chensj 的评论
有没有谁遇到这个,文章添加的时候报这个错
Class '\kucha\ueditor\UEditor' not found- in D:\WWW\xxx\common\core\ActiveField.php at line 139
kucha\ueditor\UEditor是有的了
这里$this->parts['{input}'] = '
'.$class::widget($config).'';找不到你在view中调用widget出错?
- e282486518 回复了 gxp 的评论
我这里遇到个问题:
admin/123456登陆到后台,打开chorme调试面板,console界面出现这个错误
GET http://mybackend.yii2.cn:8080/debug/default/toolbar?tag=59bc73c7dc67e 404 (Not Found),点击收件箱和通知都无效,点击订单管理页面有效.望指导下这个怎么解决,感谢。我下载的代码是全站打包代码。
配置文件server {
listen 8080; root 安装目录/frontend/web; index index.php index.html; server_name my.yii2.cn; charset utf-8; # location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|pdf|ppt|txt|bmp|rtf|js)$ { # access_log off; # expires max; # } location / { try_files $uri $uri/ /index.php?$args; } client_max_body_size 32m; # There is a VirtualBox bug related to sendfile that can lead to # corrupted files, if not turned-off # sendfile off; location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; }
}
server {
listen 8080; root 安装目录/backend/web; index index.php index.html; server_name mybackend.yii2.cn; charset utf-8; client_max_body_size 16m;
location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; }
}
存储
server {
listen 8080; server_name mystorage.yii2.cn; root 安装目录/storage/web; index index.html; # expires max; location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; }
}
1、debug/default/toolbar 无法访问可能是没有权限,查看backend/config/main.php是否有'as rbac' => []的配置项。
/** * 通过配置文件附加行为,全局 */ 'as rbac' => [ 'class' => 'backend\behaviors\RbacBehavior', 'allowActions' => [ 'login/login','login/logout','public*','debug/*','gii/*', // 不需要权限检测 ] ],
收件箱等都还没做
- e282486518 回复了 zzybeyond 的评论
是我眼睛不好使吗?找半天没看到数据库啊。呵呵
doc/yii2admin.sql
或者
在执行php ./yii install
时会执行console/migrations/
中的文件安装数据库