public function actionComment() { $comment = new Comment(); if (isset($_POST['Comment'])) { $comment->shareId = $_POST['Comment']['shareId']; $comment->createTime = time(); $comment->replyId = $_POST['Comment']['replyId']; $comment->content = $_POST['Comment']['content']; $comment->userId = Yii::app()->user->userId; $clientFlash = new ClientFlash(); if ($comment->validate() && $comment->save()) { $clientFlash->setFlash(0, 'comment', '评论成功'); } else { $clientFlash->setFlash(1, 'comment', '评论失败'); } } $this->render('comment', array('commentForm' => $comment)); }