<?php namespace appmodel; use thinkModel; class User1 extends Model { public function getStatusTextAttr($value,$data){ $status = [ '1'=>'正常', '2'=>'待审核', '0'=>'删除' ]; return $status[$data['status']]; } }
控制器输出
dump($result['status_text']);