dmodai
- dmodai 2016-05-05 已签到连续签到1天,获得了5个金钱
- dmodai 回复了 littlerunner 的评论
因为不熟悉yii。所以我只好把所有log都打出来给您看了--!。我的环境是centos php7 nginx
在访问localhost/yii-master/frontend/web/index.php时的报错如下:An Error occurred while handling another error: yii\base\InvalidParamException: The view file does not exist: /home/study/yii-master/frontend/views/site/error.php in /home/study/yii-master/vendor/yiisoft/yii2/base/View.php:226 Stack trace: #0 /home/study/yii-master/vendor/yiisoft/yii2/base/View.php(149): yii\base\View->renderFile('/home/study/yii...', Array, Object(frontend\controllers\SiteController)) #1 /home/study/yii-master/vendor/yiisoft/yii2/base/Controller.php(371): yii\base\View->render('error', Array, Object(frontend\controllers\SiteController)) #2 /home/study/yii-master/vendor/yiisoft/yii2/web/ErrorAction.php(108): yii\base\Controller->render('error', Array) #3 [internal function]: yii\web\ErrorAction->run() #4 /home/study/yii-master/vendor/yiisoft/yii2/base/Action.php(92): call_user_func_array(Array, Array) #5 /home/study/yii-master/vendor/yiisoft/yii2/base/Controller.php(151): yii\base\Action->runWithParams(Array) #6 /home/study/yii-master/vendor/yiisoft/yii2/base/Module.php(455): yii\base\Controller->runAction('error', Array) #7 /home/study/yii-master/vendor/yiisoft/yii2/web/ErrorHandler.php(85): yii\base\Module->runAction('site/error') #8 /home/study/yii-master/vendor/yiisoft/yii2/base/ErrorHandler.php(109): yii\web\ErrorHandler->renderException(Object(yii\web\NotFoundHttpException)) #9 /home/study/yii-master/vendor/yiisoft/yii2/web/Application.php(98): yii\base\ErrorHandler->handleException(Object(yii\web\NotFoundHttpException)) #10 /home/study/yii-master/vendor/yiisoft/yii2/base/Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request)) #11 /home/study/yii-master/frontend/web/index.php(19): yii\base\Application->run() #12 {main} Previous exception: yii\web\NotFoundHttpException: 页面不存在 in /home/study/yii-master/frontend/controllers/PageController.php:19 Stack trace: #0 [internal function]: frontend\controllers\PageController->actionIndex('') #1 /home/study/yii-master/vendor/yiisoft/yii2/base/InlineAction.php(55): call_user_func_array(Array, Array) #2 /home/study/yii-master/vendor/yiisoft/yii2/base/Controller.php(151): yii\base\InlineAction->runWithParams(Array) #3 /home/study/yii-master/vendor/yiisoft/yii2/base/Module.php(455): yii\base\Controller->runAction('index', Array) #4 /home/study/yii-master/vendor/yiisoft/yii2/web/Application.php(84): yii\base\Module->runAction('page/index', Array) #5 /home/study/yii-master/vendor/yiisoft/yii2/base/Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request)) #6 /home/study/yii-master/frontend/web/index.php(19): yii\base\Application->run() #7 {main}
@yidashi 请问你现在有完整的正确的sql了吗, 楼主github上的还是错的
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'yii.pop_auth_item_child' doesn't exist The SQL being executed was: SELECT * FROM `pop_auth_item_child` Error Info: Array ( [0] => 42S02 [1] => 1146 [2] => Table 'yii.pop_auth_item_child' doesn't exist )
安装后缺少表
@Tinywan 请问你现在有完整的正确的sql了吗, 楼主github上的还是错的
- dmodai 回复了话题 YII对数据库的增加操作。
Info::find()->where(['id'=>0])->delete();
- dmodai 2016-04-29 已签到连续签到5天,获得了20个金钱
- dmodai 评论了源码 基于yii2的内容管理框架
SQL 查询:
我命令导入错误,直接导入sql语句报错:INSERT INTO `pop_category` VALUES ( 1, '默认', 0, 1449050838, 1449050838, 'moren' ) ; MySQL 返回: 文档 #1136 - Column count doesn't match value count at row 1
能给一份正常的init.sql给我们吗
请问在显示首页详细文章中actionDetail中,发表匿名评论的时候, 第一次是点击“发布”才可以发表评论成功,然后回到本页面,然后我F5刷新页面又会提交一次
$postModel = new Comment(); print_r(Yii::$app->request->post()); if ($postModel->load(Yii::$app->request->post())) { $postModel->status=Comment::STATUS_PENDING; $postModel->post_id=$id; if ($postModel->save()) { $this->added=1; } /* $this->redirect(['post/detail', 'id'=>$id]);*/ }
在一次提交评论后我打印post都有数据, 导致刷新页面都会提交评论(之前的评论);如果我redirect就不会提交重复评论,但是added之类的就显示不出来了
请问怎么解决这个问题@辣椒红龙 还是要靠后端来控制
if ($postModel->load($request->post())) { if(time() - $session->get('createComment') > 15 ) { $postModel->status = Comment::STATUS_PENDING; $postModel->post_id = $id; if ($postModel->save()) { $this->added = 1; } $session->set('createComment', time()); //$this->redirect(['post/detail', 'id'=>$id, 'added'=>$this->added]); }else{ //时间不够 } }