欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

PHP YII框架的来帮忙了,多谢了

程序员文章站 2022-04-20 12:25:14
...
PHP YII框架的来帮忙了,谢谢了
先看代码。
MODEL层代码如下:
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('KEYID', 'numerical'),
array('STUDYID', 'length', 'max'=>30),
array('MH7AYN, MH7D51, MH7D52, MH7D6, MH7C1')
array('MH7B4, MH7C5', 'length', 'max'=>100),
array('MH7D10, MH7D11','length','max'=>2),
array('KEYID, STUDYID, SUBJID, SITEID, SUBJINIT, RANDNO, VISIT, VISITNUM, CRFPAGE, SEQNO, ENTRYNO, KEY1, KEY2, KEY3, MH7AYN, MH7D51, MH7D52, MH7D6, MH7C1')
);
}

public function search()
{
// Warning: Please modify the following code to remove attributes that
// should not be searched.

$criteria=new CDbCriteria;

$criteria->compare('KEYID',$this->KEYID);
$criteria->compare('STUDYID',$this->STUDYID,true);
$criteria->compare('SUBJID',$this->SUBJID,true);
$criteria->compare('SITEID',$this->SITEID,true);
$criteria->compare('SUBJINIT',$this->SUBJINIT,true);
$criteria->compare('RANDNO',$this->RANDNO,true);
$criteria->compare('VISIT',$this->VISIT,true);
$criteria->compare('VISITNUM',$this->VISITNUM,true);
$criteria->compare('CRFPAGE',$this->CRFPAGE,true);
$criteria->compare('SEQNO',$this->SEQNO);
$criteria->compare('ENTRYNO',$this->ENTRYNO);
$criteria->compare('KEY1',$this->KEY1,true);
$criteria->compare('KEY2',$this->KEY2,true);
$criteria->compare('KEY3',$this->KEY3,true);
$criteria->compare('MH7AYN',$this->MH7AYN,true);
$criteria->compare('MH7D51',$this->MH7D51,true);
$criteria->compare('MH7D52',$this->MH7D52,true);
$criteria->compare('MH7D6',$this->MH7D6,true);
$criteria->compare('MH7D7',$this->MH7C1,true);
return new CActiveDataProvider(get_class($this), array(
'criteria'=>$criteria,
));
}
在用MH7C1的时候怎么显示 “未定义呀?”高手忙

------解决方案--------------------
少个 , ?
------解决方案--------------------
不了解 YII,不过从代码上看
$criteria->compare('MH7D6',$this->MH7D6,true);
是将 rules 返回的结果与对象的属性对应起来
那么
$criteria->compare('MH7D7',$this->MH7C1,true);
中 MH7D7 并不在 rules 返回的结果中

------解决方案--------------------
PHP code
array('STUDYID', 'length', 'max'=>30),array('MH7AYN, MH7D51, MH7D52, MH7D6, MH7C1')  array('MH7B4, MH7C5', 'length', 'max'=>100),array('MH7D10, MH7D11','length','max'=>2),
PHP YII框架的来帮忙了,多谢了

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。

相关文章

相关视频