Heim >Backend-Entwicklung >PHP-Tutorial >PHP YII框架的来帮忙了,多谢了

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

WBOY
WBOYOriginal
2016-06-13 10:29:04876Durchsuche

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),<div class="clear">
                 
              
              
        
            </div>
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn