-
Notifications
You must be signed in to change notification settings - Fork 255
/
yii
39 lines (32 loc) · 1.2 KB
/
yii
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env php
<?php
/**
* Yii console bootstrap file.
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
/* 由于程序中要用到env中的某些数据,所以第一次运行时要先创建.env文件,不然会出错 */
if (!is_file(__DIR__.'/.env')) {
copy(__DIR__.'/.env.example', __DIR__.'/.env');
}
require(__DIR__ . '/vendor/autoload.php');
require(__DIR__ . '/vendor/yiisoft/yii2/Yii.php');
/**
* 全局环境,必须放在yii.php之后和config文件之前
* 因为里面用到Yii类,配置中又要用到env函数
* 这个文件转到 composer.json -> autoload -> files -> common/env.php 中了
*/
//require(__DIR__ . '/common/env.php');
require(__DIR__ . '/common/config/bootstrap.php');
require(__DIR__ . '/console/config/bootstrap.php');
$config = yii\helpers\ArrayHelper::merge(
require(__DIR__ . '/common/config/main.php'),
require(__DIR__ . '/common/config/main-local.php'),
require(__DIR__ . '/console/config/main.php'),
require(__DIR__ . '/console/config/main-local.php')
);
$application = new yii\console\Application($config);
$exitCode = $application->run();
exit($exitCode);