Yii 无法回显位于扩展/引导/小部件中的文件中的数据
我使用的是Yii 1.1。我在widgets文件夹中有一个名为MyCommentsTbEditableSaver的类文件。 当我尝试回显php文件中的数据时,它不会返回任何东西。 这背后的原因是什么? 我的代码:`Yii 无法回显位于扩展/引导/小部件中的文件中的数据,yii,Yii,我使用的是Yii 1.1。我在widgets文件夹中有一个名为MyCommentsTbEditableSaver的类文件。 当我尝试回显php文件中的数据时,它不会返回任何东西。 这背后的原因是什么? 我的代码:` public function insertRps() { //get params from request $this->primaryKey = yii::app()->request->getParam('pk'); $this-&g
public function insertRps()
{
//get params from request
$this->primaryKey = yii::app()->request->getParam('pk');
$this->attribute = yii::app()->request->getParam('name');
//$this->attribute = yii::app()->request->getParam('comments');
$this->value = yii::app()->request->getParam('value');
//checking params
if (empty($this->attribute)) {
throw new CException(Yii::t('MyCommentsTbEditableSaver.editable', 'Property "attribute" should be defined.'));
}
if (empty($this->primaryKey)) {
throw new CException(Yii::t('MyCommentsTbEditableSaver.editable', 'Property "primaryKey" should be defined.'));
}
$model=new ProjectComments();
$comments=Yii::app()->db->createCommand()
->select('count(project_id) as countProject')
->from('pm_project_comments')
->where("project_id = $this->primaryKey ")
->queryRow();
if($comments['countProject']==0)
{
$model->isNewRecord=TRUE;
$model->comments_rps=$this->value;
$model->project_id=$this->primaryKey;
//also set update details,added by bishal
$model->crtd_by=Yii::app()->user->id;
$model->crtd_dt = date('Y-m-d');
print_r($model);die;
$model->save();
}
}`
此处print($model)不返回任何值。您确定这部分代码已执行吗?是的,我也在调试模式下运行此代码。但未返回任何结果。