zh761324952

zh761324952

这家伙有点懒,还没写个性签名!

  • 财富值280
  • 威望值50
  • 总积分880

个人信息

  • 支持 你必须带上关联字段哦 不然怎么组合数据

    $query->with([
        'user'=>function($query){
            $query->select('id,username');
        }
    ]);
    
  •     /**
         * 初始化
         * (non-PHPdoc)
         * @see CController::init()
         */
        public function init()
        {
            parent::init();
            $_this = $this;
            $this->enableCsrfException = function ($_this, $request) {
                throw new CHttpException(200, Yii::t('yii','The CSRF token could not be verified.'), 400);
            };
        }
    
    
        /**
         * 过滤ip地址
         * @param unknown $ip
         * @return boolean
         */
        public static function allowIp($ip, $ipFilters)
        {
            if(empty($ipFilters)) {
                return true;
            }
            foreach($ipFilters as $filter) {
                if($filter==='*' || $filter===$ip || (($pos=strpos($filter,'*'))!==false && !strncmp($ip,$filter,$pos))) {
                    return true;
                }
            }
            return false;
        }
    
  • 赞了说说
    刚毕业,就被逼婚,心好累
  •  copy(Yii::getAlias('@base/.env.example'), Yii::getAlias($this->envPath)); //@root报错
    
      > create table {{%auth_assignment}} ... done (time: 0.067s)
        > add foreign key fk_{{%auth_item}}_165_00: {{%auth_assignment}} (item_name)
     references {{%auth_item}} (name) ...Exception 'yii\db\Exception' with message '
    SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in you
    r SQL syntax; check the manual that corresponds to your MySQL server version for
     the right syntax to use near '`auth_item`_165_00 FOREIGN KEY (`item_name`) REFE
    RENCES `auth_item` (`name`) ON ' at line 1
    The SQL being executed was: ALTER TABLE `auth_assignment` ADD CONSTRAINT fk_`aut
    h_item`_165_00 FOREIGN KEY (`item_name`) REFERENCES `auth_item` (`name`) ON DELE
    TE CASCADE ON UPDATE CASCADE'
    db\Command->execute()
    #2 D:\wamp\www\yii2app\yii2admin\console\migrations\m161119_161029_auth_assignme
    nt.php(23): yii\db\Migration->addForeignKey('fk_{{%auth_item...', '{{%auth_assig
    nm...', 'item_name', '{{%auth_item}}', 'name', 'CASCADE', 'CASCADE')
    #3 D:\wamp\www\yii2app\yii2admin\vendor\yiisoft\yii2\console\controllers\BaseMig
    

    这个错误……

  • 加在数组中啊

    'urlManager' => array(
      'class' => 'UrlManager',
       //....
    )
    
主管 等级规则
880/1000
资料完整度
20/100
用户活跃度
0/100

Ta的关注

3

Ta的粉丝

4

Ta的访客

10