johnny1991

johnny1991

xxxxxxxxxxxxxxxxxxxxx

  • 财富值3285
  • 威望值580
  • 总积分9895

个人信息

  • yii\validators\Validate的源码,应该是可以的

    public function validateAttributes($model, $attributes = null)
        {
            if (is_array($attributes)) {
                $newAttributes = [];
                $attributeNames = $this->getAttributeNames();
                foreach ($attributes as $attribute) {
                    if (in_array($attribute, $attributeNames, true)) {
                        $newAttributes[] = $attribute;
                    }
                }
                $attributes = $newAttributes;
            } else {
                $attributes = $this->getAttributeNames();
            }
    
            foreach ($attributes as $attribute) {
                $skip = $this->skipOnError && $model->hasErrors($attribute)
                    || $this->skipOnEmpty && $this->isEmpty($model->$attribute);
                if (!$skip) {
                    if ($this->when === null || call_user_func($this->when, $model, $attribute)) {
                        $this->validateAttribute($model, $attribute);
                    }
                }
            }
        }
    
  • 收藏了扩展
    yii2 的消息系统
  • $t1 = Yii::$app->db1->beginTransaction(); 
    $t2 = Yii::$app->db2->beginTransaction(); 
    try {
        if(update a failed) {
            throw new Exception('update a failed');
        }
        if(update b failed) {
            throw new Exception('update b failed');
        }
        $t1.commit();
        $t2.commit();
    } cacth(Exception $e) {
        $t1.rollback();
        $t2.rollback();
    }
    
  • 发布了教程
    redis 主从配置及持久化
  • 2018-08-29 已签到
    连续签到1天,获得了5个金钱
  • 2018-08-26 已签到
    连续签到1天,获得了5个金钱
  • 2018-08-22 已签到
    连续签到1天,获得了5个金钱
  • 2018-08-16 已签到
    连续签到1天,获得了5个金钱
  • 2018-08-13 已签到
    连续签到1天,获得了5个金钱
  • 2018-08-01 已签到
    连续签到2天,获得了10个金钱
副总裁 等级规则
9895/10000
资料完整度
60/100
用户活跃度
0/100

Ta的关注

19

Ta的粉丝

26

Ta的访客

81