http://doc.thinkphp.cn/manual/field_define.html
protected $fields = array(
'id', 'username', 'email', 'age', '_pk' => 'id', '_autoinc' => true
);3.2http://document.thinkphp.cn/manual_3_2.html#define_fields
namespace Home\Model;
use Think\Model;
class UserModel extends Model {
protected $fields = array('id', 'username', 'email', 'age','_pk'=>'id');
} 最佳答案