首頁 > 後端開發 > php教程 > PHP YII框架的来帮忙了,多谢了

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

WBOY
發布: 2016-06-13 10:29:04
原創
876 人瀏覽過

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>
登入後複製
相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板