model裡:
復制代碼 代碼如下:
public function item($items,$name){
$returnValue='';
foreach($items as $n=>$item){
if(isset($this->$name)){
if($n==$this->$name){
$returnValue=$item;
}
}
}
return $returnValue;
}
view裡:
復制代碼 代碼如下:
array('name'=>'isPass','value'=>'$data->item(array(\'1\'=>\'是\',\'0\'=>\'否\'),\'isProcess\')','filter'=>array('1'=>'是','0'=>'否')),
更簡單些
復制代碼 代碼如下:
'value'=> '$data->ispass == "1" ? "是" : "否"',