public function hex($len = null) { return parent::hex($len); }
/** * 插入前的自动处理 * */ public function beforeCreate() { // 字段未定义,并且是 NULL,在此处理 $this->datetime = $this->updated = $this->created = date('Y-m-d H:i:s'); $random = new Random(); $this->salt = substr(uniqid($random->hex(6)), -6); $this->password = md5(md5($this->password) . $this->salt); }