標籤:thinkphp5
// +----------------------------------------------------------------------// | ThinkPHP [ WE CAN DO IT JUST THINK ]// +----------------------------------------------------------------------// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.// +----------------------------------------------------------------------// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )// +----------------------------------------------------------------------// | Author: liu21st <[email protected]>// +----------------------------------------------------------------------namespace think;// 放到同一個大包 下面use think\Config;// 使用 配置類use think\Env;// 使用環境類use think\Exception;// 使用異常包use think\exception\HttpException;// 使用異常包 http包use think\exception\HttpResponseException;// 使用異常包 http response 包use think\Hook;// 使用 鉤子 類use think\Lang;// 使用 語言 類use think\Loader;// 使用 載入 類use think\Log;// 使用 日誌 類use think\Request;// 使用 請求 類use think\Response;// 使用 返回 類use think\Route;// 使用 路由 類// 這個類應算是 皇上類了 可以調度基本上 全部的資源/** * App 應用管理 * @author liu21st <[email protected]> */class App{ /** * @var bool 是否初始化過 */ protected static $init = false;// 初始化 標誌位 /** * @var string 當前模組路徑 */ public static $modulePath;// 初始化 當前 模組 路徑 /** * @var bool 應用偵錯模式 */ public static $debug = true;// 應用調試 模式 /** * @var string 應用類庫命名空間 */ public static $namespace = ‘app‘;// 應用 類庫 命名空間 /** * @var bool 應用類庫尾碼 */ public static $suffix = false;// 應用 類庫 尾碼 /** * @var bool 應用路由檢測 */ protected static $routeCheck;// 應用 路由 檢測 /** * @var bool 嚴格路由檢測 */ protected static $routeMust; // 嚴格 路由檢測 protected static $dispatch;// 路由調度 protected static $file = []; // 檔案載入 /** * 執行應用程式 * @access public * @param Request $request Request對象 * @return Response * @throws Exception */ public static function run(Request $request = null) {// thinkphp經過了 自動載入、錯誤接管、設定檔預設,終於開始執行了。 // 第一步:擷取請求參數 is_null($request) && $request = Request::instance(); // self::$instance = new static($options); 執行了 這個 instance // 預設 沒有傳入任何數值,is_null 所以執行 後面 $request = Request::instance(); // 這個寫法 真的 很經典,我喜歡你,老劉,哈哈 // 最終擷取了 一個 request 對象 $config = self::initCommon();// 載入 初始化 配置 檔案 選項
本文出自 “專註php 群號:414194301” 部落格,請務必保留此出處http://jingshanls.blog.51cto.com/3357095/1859690
[李景山php]每天TP5-20161211|App.php-1