Skip to content

Commit

Permalink
添加入口文件的注释
Browse files Browse the repository at this point in the history
  • Loading branch information
CraryPrimitiveMan committed Oct 21, 2015
1 parent 8a7b8cf commit c24991d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions apps/basic/web/index.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
<?php

// comment out the following two lines when deployed to production
// 定义 debug 的标记
defined('YII_DEBUG') or define('YII_DEBUG', true);
// 定义环境,有 'dev' 和 'prod' 两种
defined('YII_ENV') or define('YII_ENV', 'dev');

// 引入 vendor 中的 autoload.php 文件,会基于 composer 的机制自动加载类
require(__DIR__ . '/../vendor/autoload.php');
// 引入 Yii 框架的文件 Yii.php
require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');

// 引入 web 的 config 文件,并将返回值即配置项放入 $config 变量中
$config = require(__DIR__ . '/../config/web.php');

// new 一个 yii\web\Application 的实例,并执行它的 run 方法
// 用 $config 作为 yii\web\Application 初始化的参数
(new yii\web\Application($config))->run();
5 changes: 5 additions & 0 deletions apps/basic/yii
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@
defined('YII_DEBUG') or define('YII_DEBUG', true);

// fcgi doesn't have STDIN and STDOUT defined by default
// 定义 STDIN 和 STDOUT
defined('STDIN') or define('STDIN', fopen('php://stdin', 'r'));
defined('STDOUT') or define('STDOUT', fopen('php://stdout', 'w'));

require(__DIR__ . '/vendor/autoload.php');
require(__DIR__ . '/vendor/yiisoft/yii2/Yii.php');

// 引入 console 的 config 文件,并将返回值即配置项放入 $config 变量中
$config = require(__DIR__ . '/config/console.php');

// new 一个 yii\console\Application 的实例,并执行它的 run 方法
// 用 $config 作为 yii\console\Application 初始化的参数
$application = new yii\console\Application($config);
$exitCode = $application->run();
// 退出
exit($exitCode);

0 comments on commit c24991d

Please sign in to comment.