model里:
01 |
public function item( $items , $name ){ |
02 |
$returnValue = '' ; |
03 |
foreach ( $items as $n => $item ){ |
04 |
if (isset( $this -> $name )){ |
05 |
if ( $n == $this -> $name ){ |
06 |
$returnValue = $item ; |
07 |
} |
08 |
} |
09 |
} |
10 |
return $returnValue ; |
11 |
} |
view里:
1 |
array ( 'name' => 'isPass' , 'value' => '$data->item(array(\'1\'=>\'是\',\'0\'=>\'否\'),\'isProcess\')' , 'filter' => array ( '1' => '是' , '0' => '否' )), |
更简单些
1 |
'value' => '$data->ispass == "1" ? "是" : "否"' , |