//Yii2中的规则,用户名的规则,1、用户名只能是字母 2、判断用户名已经存在 3、用户名的长度 4、用户名不能为空
[['username'], 'match', 'pattern' => '/^[a-z]\w*$/i'],
['username', 'unique', 'targetClass' => '\common\models\User', 'message' => '用户名已存在'],
['username', 'string', 'min' => 5, 'max' => 255],

//Yii2中的规则,电话号码的规则
['mobile_phone', 'required','message' => '手机号码不能为空'],
['mobile_phone', 'filter', 'filter' => 'trim'],
[['mobile_phone'], 'match', 'pattern' => '/^(1(([35][0-9])|(47)|[8][0126789]))\d{8}$/'],
['mobile_phone', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This mobile phone number has already been taken.'],

//密码的规则,重复密码的规则
['password', 'required'],
['password', 'string', 'min' => 6],
['rePassword', 'compare', 'compareAttribute' => 'password'],

//邮箱的规则
['email','email','message' => '您输入的邮箱错误'],
['email', 'unique', 'targetClass' => '\common\models\User', 'message' => '这个邮箱已经被注册了'],

//url规则

['store_logo', 'url'],

['start_time', 'filter', 'filter' => 'strtotime'],
['end_time', 'filter', 'filter' => 'strtotime'],

//默认值
['status', 'default', 'value'=>self::STATUS_CHECK],

最新文章

  1. 带有静态方法的类(java中的math类)
  2. 【leetcode】Insert Interval(hard)★
  3. BZOJ3417 : Poi2013 Tales of seafaring
  4. 第七章 企业项目开发--本地缓存guava cache
  5. Python字典笔记
  6. 基于React服务器端渲染的博客系统
  7. [4X]荣耀畅玩4X开箱实录
  8. selenium资料
  9. ASP.NET-FineUI开发实践-13(二)
  10. asp.net mvc3 数据验证(四)—Remote验证的一个注意事项
  11. 2017年PHP培训机构排名
  12. Windows7 64位安装最新版本MySQL服务器
  13. 464. Can I Win
  14. Nginx 在 Linux 上的安装和配置
  15. 破解xlsm文件的VBA项目密码和xlsx的工作簿保护密码
  16. Hadoop.之.入门部署
  17. oracle 锁表查看与解锁
  18. 转:queue
  19. apache目录别名
  20. eclipse中的项目鼠标右键卡死

热门文章

  1. 查看tomcat的版本号
  2. The user specified as a definer ('root'@'%') does not exist解决
  3. MySQL事务调优
  4. 推荐五个java基础学习网站,小白必备
  5. 阿里云移动研发平台EMAS,是如何连续5年安全护航双11的?
  6. java版扫雷
  7. nginx 配置多服务器代理
  8. 【Tomcat】2.配置Tomcat服务器端口和HTTPS
  9. mybatis plus CRUD
  10. 内核module读取进程页目录