auto属性自动完成包含新增和更新操作 namespace app\index\model; use think\Model; class User extends Model { protected $auto = ['email'=>'thinkphp@qq.com','ip']; public function setIpAttr(){ return request() -> ip(); } } // 系统会自动将email写入 thinkphp@qq.com , ip 自动写入当前的
1.具体见注释 2.后续或有更新 public class MyArray { private long[] array; private int cnt; // 自定义数组类的元素个数 /** 使用自定义类封装数组,添加类方法实现数据操作 */ public MyArray() { array = new long[50]; } public MyArray(int size) { array = new long[size]; } /** 插入数据,返回值为空 */ public void
在Model使用的时候很多人回向以前写三层架构一样使用它,将Model作为数据的传递者. 比如常见的写法 public int Id { get; set; } public int RoleId { get; set; } public string Name { get; set; } public string Password { get; set; } public string NickName { get; set; } public string Avatar { get; se
最近做mybatis+oracle项目的时候解决添加一条数据并返回所添加数据的主键问题 controller层 @RequestMapping("/addplan") public @ResponseBody OnlineAddplanWithBLOBs insertOnlineAddplan(OnlineAddplanWithBLOBs plan) throws Exception{ //plan是添加的数据,planid为数据主键,此时对象中主键为null int n = serv
1.日志报错 rancher导入k8s集群后添加监控无数据,rancher日志报错: k8s.io/kube-state-metrics/pkg/collectors/builder.go:: Failed to list *v1beta1.PodDisruptionBudget: poddisruptionbudgets.policy is forbidden: User "system:serviceaccount:cattle-prometheus:exporter-kube-state-