wayneluo
- wayneluo 赞了回复
最简单的方法:
直接在模块下面的moule.php里面加上这一句: - wayneluo 赞了评论
不适合初学者 这个是白狼大神的通病 大神只需要把代码共享出来 自会有人分析
打印出来的SQL语句是对的,但是前端显示却是not set空的
$query2 = ServerAccount::find(); $query2->joinWith(['accountType']); $query2->select('server_account.*,account_type.type'); $b = clone $query2; $lastSql = $b->createCommand()->getRawSql(); print_r($lastSql); //SELECT `server_account`.*, `account_type`.`type` FROM `server_account` LEFT JOIN `account_type` ON `server_account`.`account_type` = `account_type`.`id` $dataProvider = new ActiveDataProvider([ 'query' => $query2, 'pagination' => [ 'pageSize' => 10, ], ]); print_r($query2->all());//如下
account_type的type字段没有加到数组里
打印出来的SQL语句是对的,但是前端显示却是not set空的
$query2 = ServerAccount::find(); $query2->joinWith(['accountType']); $query2->select('server_account.*,account_type.type'); $b = clone $query2; $lastSql = $b->createCommand()->getRawSql(); print_r($lastSql); //SELECT `server_account`.*, `account_type`.`type` FROM `server_account` LEFT JOIN `account_type` ON `server_account`.`account_type` = `account_type`.`id` $dataProvider = new ActiveDataProvider([ 'query' => $query2, 'pagination' => [ 'pageSize' => 10, ], ]); print_r($query2->all());//如下
[id] => 11 [account_type] => 2 [name] => a [hostname] => q,x,a,才,1 [ip] => 1 [username] => 123 [password] => dsadsa [expiry] => 20010101 [created_at] => 1515465533 [updated_at] => 1515468022 ) [_related:yii\db\BaseActiveRecord:private] => Array ( [accountType] => common\models\AccountType Object ( [_attributes:yii\db\BaseActiveRecord:private] => Array ( [id] => 2 [type] => 服务器账号 ) [_oldAttributes:yii\db\BaseActiveRecord:private] => Array ( [id] => 2 [type] => 服务器账号 )
打印出来的SQL语句是对的,但是前端显示却是not set空的
$query2 = ServerAccount::find(); $query2->joinWith(['accountType']); $query2->select('server_account.*,account_type.type'); $b = clone $query2; $lastSql = $b->createCommand()->getRawSql(); print_r($lastSql); //SELECT `server_account`.*, `account_type`.`type` FROM `server_account` LEFT JOIN `account_type` ON `server_account`.`account_type` = `account_type`.`id` $dataProvider = new ActiveDataProvider([ 'query' => $query2, 'pagination' => [ 'pageSize' => 10, ], ]); print_r($query2->all());//如下
- wayneluo 提出了问题请问Html::ul 列表怎么用
- wayneluo 2018-01-07 已签到连续签到1天,获得了5个金钱
- wayneluo 赞了回复
在你的表单里面加上一个隐藏域,再次提交时就会在URL中拼凑出r='sys/index'这一段了
- wayneluo 赞了回复
在你的表单里面加上一个隐藏域,再次提交时就会在URL中拼凑出r='sys/index'这一段了
<input type="hidden" name="r" value="sys/index">
- wayneluo 2017-11-23 已签到连续签到2天,获得了10个金钱