Controller源代码
<?php namespace app\index\controller; use app\BaseController; use app\index\model\Admins; class Index extends BaseController { public function index() { $db = new Admins(); $index = $db->index(); print_r($index->status); } }
Model源代码
<?php namespace app\index\model; use think\Model; class Admins extends Model { public function index() { $select=Admins::find(1); return $select; } public function getStatusAttr($value) { $status = [1=>'禁用',0=>'正常']; return $status[$value]; } }