Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/299.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在yii中存储post视图中的注释数据_Php_Yii - Fatal编程技术网

Php 在yii中存储post视图中的注释数据

Php 在yii中存储post视图中的注释数据,php,yii,Php,Yii,我可以通过以下代码在帖子中获得评论的形式 <?php $comment= new Comment(); $this->renderPartial('/comment/_form',array('model'=>$comment,)); ?> 但是现在需要将post-view评论表单中填写的数据存储在数据库中。 另一个问题是,在create new comment的comment表单中填充数据时,它会在数据库中创建两个类似的记录。您的问题没有得到很清楚的

我可以通过以下代码在帖子中获得评论的形式

<?php $comment= new Comment();
        $this->renderPartial('/comment/_form',array('model'=>$comment,)); 
?>
但是现在需要将post-view评论表单中填写的数据存储在数据库中。
另一个问题是,在create new comment的comment表单中填充数据时,它会在数据库中创建两个类似的记录。

您的问题没有得到很清楚的解释,但据我所知,您应该尝试查看CFormModel及其验证程序


如果您想讨论详细信息,请告诉我。

查看此帖子,并在此处发布您的操作代码以进行分析