thinkPhp5返回某些指定字段

//去除掉密码
 $db = new UserModel();
 $result = $db->field('password',true)->where("username='{$params['username']}' AND password='{$params['password']}'")->find();

或者指定要的字段的数组 


 $db = new UserModel();
 $result = $db->field(['username','create_time'])->where("username='{$params['username']}' AND password='{$params['password']}'")->find();

thinkPhp5返回某些指定字段_第1张图片

查询符合条件的多条数据

 $db2 = new RoleRightModel();
 $result2 = $db2->field('right_id')->where('role_id',1)->select();

thinkPhp5返回某些指定字段_第2张图片 

你可能感兴趣的:(java,前端,服务器)