- Yii2 By Example
- Fabrizio Caldarelli
- 166字
- 2021-07-16 19:38:53
Application structure
Yii2's application structure is very clear, precise, and redundant (for advanced applications).
The contents of the basic
folder should be as follows:

Open web/index.php
to view content:
<?php // comment out the following two lines when deployed to production defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_ENV') or define('YII_ENV', 'dev'); require(__DIR__ . '/../vendor/autoload.php'); require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php'); $config = require(__DIR__ . '/../config/web.php'); (new yii\web\Application($config))->run();
Here, the first two constant definitions are very important.
YII_DEBUG
defines whether you are in debug mode or not. If we set this, we will have more log information and will see the detail error call stack.
YII_ENV
defines the environment mode we are working in, and its default value is prod
. The available values are test
, dev
, and prod
. These values are used in configuration files to define, for example, a different DB connection (local database different from remote database) or other values, always in configuration files.
Since we are at the start of our project, it is recommended to set YII_DEBUG
to true
, in order to have more detailed information in case we make a mistake in our code, instead of the unhelpful, blank.
The following table contains a list of all Yii2's objects:

- 深入淺出Windows API程序設計:編程基礎篇
- Web Application Development with MEAN
- Microsoft Dynamics GP 2013 Reporting, Second Edition
- Angular開發入門與實戰
- Unity 2017 Mobile Game Development
- CoffeeScript Application Development Cookbook
- Java程序員面試筆試寶典(第2版)
- 響應式Web設計:HTML5和CSS3實戰(第2版)
- Spring技術內幕:深入解析Spring架構與設計原理(第2版)
- Go語言開發實戰(慕課版)
- Learning Splunk Web Framework
- Greenplum構建實時數據倉庫實踐
- Java高并發編程詳解:深入理解并發核心庫
- SAP HANA Starter
- The Java Workshop