zh761324952
支持 你必须带上关联字段哦 不然怎么组合数据
$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; }
- zh761324952 赞了说说刚毕业,就被逼婚,心好累
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
这个错误……
- zh761324952 关注了Danmo
- zh761324952 评论了源码 实现URL重写兼容模式
加在数组中啊
'urlManager' => array( 'class' => 'UrlManager', //.... )