Authored by wuxiao

修改基础入口引用配置的方式

1 <?php 1 <?php
2 $params = array_merge( 2 $params = array_merge(
3 require(__DIR__ . '/../../common/config/params.php'), 3 require(__DIR__ . '/../../common/config/params.php'),
4 - require(__DIR__ . '/../../common/config/params-local.php'), 4 + (@include(__DIR__ . '/../../common/config/params-local.php'))?:[],
5 require(__DIR__ . '/params.php'), 5 require(__DIR__ . '/params.php'),
6 - require(__DIR__ . '/params-local.php') 6 + (@include(__DIR__ . '/params-local.php'))?:[]
7 ); 7 );
8 8
9 return [ 9 return [
@@ -9,9 +9,9 @@ require(__DIR__ . '/../config/bootstrap.php'); @@ -9,9 +9,9 @@ require(__DIR__ . '/../config/bootstrap.php');
9 9
10 $config = yii\helpers\ArrayHelper::merge( 10 $config = yii\helpers\ArrayHelper::merge(
11 require(__DIR__ . '/../../common/config/main.php'), 11 require(__DIR__ . '/../../common/config/main.php'),
12 - require(__DIR__ . '/../../common/config/main-local.php'), 12 + (@include(__DIR__ . '/../../common/config/main-local.php'))?:[],
13 require(__DIR__ . '/../config/main.php'), 13 require(__DIR__ . '/../config/main.php'),
14 - require(__DIR__ . '/../config/main-local.php') 14 + (@include(__DIR__ . '/../config/main-local.php'))?:[]
15 ); 15 );
16 16
17 $application = new yii\web\Application($config); 17 $application = new yii\web\Application($config);
1 <?php 1 <?php
2 $params = array_merge( 2 $params = array_merge(
3 require(__DIR__ . '/../../common/config/params.php'), 3 require(__DIR__ . '/../../common/config/params.php'),
4 - require(__DIR__ . '/../../common/config/params-local.php'), 4 + (@include(__DIR__ . '/../../common/config/params-local.php'))?:[],
5 require(__DIR__ . '/params.php'), 5 require(__DIR__ . '/params.php'),
6 - require(__DIR__ . '/params-local.php') 6 + (@include(__DIR__ . '/params-local.php'))?:[]
7 ); 7 );
8 8
9 return [ 9 return [
1 <?php 1 <?php
2 $params = array_merge( 2 $params = array_merge(
3 require(__DIR__ . '/../../common/config/params.php'), 3 require(__DIR__ . '/../../common/config/params.php'),
4 - require(__DIR__ . '/../../common/config/params-local.php'), 4 + (@include(__DIR__ . '/../../common/config/params-local.php'))?:[],
5 require(__DIR__ . '/params.php'), 5 require(__DIR__ . '/params.php'),
6 - require(__DIR__ . '/params-local.php') 6 + (@include(__DIR__ . '/params-local.php'))?:[]
7 ); 7 );
8 8
9 return [ 9 return [
@@ -14,6 +14,8 @@ return [ @@ -14,6 +14,8 @@ return [
14 'components' => [ 14 'components' => [
15 'request' => [ 15 'request' => [
16 'csrfParam' => '_csrf-frontend', 16 'csrfParam' => '_csrf-frontend',
  17 + // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
  18 + 'cookieValidationKey' => 'hNWgnTak0P0f9VAiC-2UQZTrMtjzpLoN',
17 ], 19 ],
18 'user' => [ 20 'user' => [
19 'identityClass' => 'common\models\User', 21 'identityClass' => 'common\models\User',
@@ -44,6 +46,13 @@ return [ @@ -44,6 +46,13 @@ return [
44 ], 46 ],
45 ], 47 ],
46 */ 48 */
  49 + 'db' => [
  50 + 'class' => 'yii\db\Connection',
  51 + 'dsn' => 'mysql:host=localhost;dbname=yii2advanced',
  52 + 'username' => 'root',
  53 + 'password' => '',
  54 + 'charset' => 'utf8',
  55 + ],
47 ], 56 ],
48 'params' => $params, 57 'params' => $params,
49 ]; 58 ];
@@ -9,9 +9,9 @@ require(__DIR__ . '/../config/bootstrap.php'); @@ -9,9 +9,9 @@ require(__DIR__ . '/../config/bootstrap.php');
9 9
10 $config = yii\helpers\ArrayHelper::merge( 10 $config = yii\helpers\ArrayHelper::merge(
11 require(__DIR__ . '/../../common/config/main.php'), 11 require(__DIR__ . '/../../common/config/main.php'),
12 - require(__DIR__ . '/../../common/config/main-local.php'), 12 + (@include(__DIR__ . '/../../common/config/main-local.php'))?:[],
13 require(__DIR__ . '/../config/main.php'), 13 require(__DIR__ . '/../config/main.php'),
14 - require(__DIR__ . '/../config/main-local.php') 14 + (@include(__DIR__ . '/../config/main-local.php'))?:[]
15 ); 15 );
16 16
17 $application = new yii\web\Application($config); 17 $application = new yii\web\Application($config);