当我将ubuntu从15.10升级到16.04时,我在yii2项目中有这个错误
SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #3
of SELECT list is not in GROUP BY clause and contains nonaggregated column
'iicityYii.opportunity_conditions.money' which is not functionally dependent
on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
Run Code Online (Sandbox Code Playgroud)
正在执行的SQL是:
SELECT SUM(oc.money),op.id,oc.money,
op.mantaghe,
op.`time`, op.`id`, `op`.`logo`,
`pd`.`user_id`, `op`.`name`,
`pd`.`co_name`, `op`.`address`,
`op`.`project_type_id`, `op`.`state_id`
FROM `opportunity` op
INNER JOIN `profile_details` pd ON op.user_id=pd.user_id
INNER JOIN `opportunity_conditions` oc ON op.id=oc.opportunity_id
GROUP BY `op`.`id`
ORDER BY `op`.`id` DESC
Run Code Online (Sandbox Code Playgroud)
怎么解决我的问题?
我用ubuntu 16.04.
PHP Version 7.0.4-7ubuntu2.
Apache/2.4.18 (Ubuntu).
PHP extension: mysqli(在phpmyadmin撰写).
我从我的ubuntu升级15.10 to 16.04,我有这个错误:
我的项目在我的服务器中正确运行,但我无法在我的操作系统中运行:
Database Exception – yii\db\Exception
SQLSTATE[HY000] [2002] No such file or directory
?
Caused by: PDOException
SQLSTATE[HY000] [2002] No such file or directory
in /var/www/html/iicitySite/vendor/yiisoft/yii2/db/Connection.php at line 579
Run Code Online (Sandbox Code Playgroud) 我想在GridView :: widget中添加一列
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
'owner_id',
'situation',
'address',
[
// 'attribute' => 'address',
'format' => 'html',
'label' => 'Image',
'value' => function ($data) {
return Html::img('http://iicity.ir/' . $data['address'],
['width' => '60px']);
},
],
'slideshow_text',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
Run Code Online (Sandbox Code Playgroud)
我想添加'owner_id'的名称 ,从另一个表名称在(帐户)表表中:
id = 1 name = jack
id = 2 name = sara
我使用 Yii2 框架,这是我的行为函数 ShippingController
public function behaviors()
{
return [
'access' => [
'class' => \yii\filters\AccessControl::className(),
'rules' => [
// deny all POST requests
// [
// 'actions' => ['index', 'create'],
// 'allow' => TRUE,
// ],
[
'actions' => ['index', 'create', 'init'],
'allow' => true,
'roles' => ['?'],
'matchCallback' => function ($rule, $action)
{
return $action->controller->redirect('action');
}
],
'denyCallback' => function ($rule, $action)
{
return $action->controller->redirect('not');
}
// everything else is denied
],
],
];
}
Run Code Online (Sandbox Code Playgroud)
matchCallback 运行良好,但
在 …
我有一个链接(href)到另一个网站,但我有问题
这是我的代码:
return Html::a('Create More', ["https://face.com/"], ['class' => 'btn btn-primary', 'role' => 'modal-remote']);
Run Code Online (Sandbox Code Playgroud)
为什么我的链接是一个新动作?我想改变我的baseurl到https://face.com/但是dosnt工作
这是我的新链接:
https://niniplus.com/newadmin/index.php/https://face.com
Run Code Online (Sandbox Code Playgroud) 我想从这个 url 字符串中找到变量:
这是我的字符串:
$var = "http://localhost/trans/site/index#ads=10"
Run Code Online (Sandbox Code Playgroud)
我怎样才能$ads从这个字符串中得到?