ZendFramework2 源碼分析 index.php

來源:互聯網
上載者:User

標籤:style   blog   io   ar   color   sp   strong   on   檔案   

 1 <?php 2 /** 3  * This makes our life easier when dealing with paths. Everything is relative 4  * to the application root now. 5  */ 6 chdir(dirname(__DIR__));  // 切換目前的目錄為活動目錄 7  8 // Decline static file requests back to the PHP built-in webserver 9 if (php_sapi_name() === ‘cli-server‘ && is_file(__DIR__ . parse_url($_SERVER[‘REQUEST_URI‘], PHP_URL_PATH))) {
    // 攔截對於目前的目錄下其他靜態檔案的訪問
10 return false;11 }12 13 // Setup autoloading14 require ‘init_autoloader.php‘; // 初始化載入15 16 // Run the application!17 Zend\Mvc\Application::init(require ‘config/application.config.php‘)->run(); // 初始化完成應用程式架構開始運行

 

總結:index.php 是安裝後原生的版本,無任何修改,內容很簡單,自動載入給應用程式架構做運行前的準備工作,然後再 利用 Application:init() 方式來初始化化,init 的參數是引入了配置目錄裡面的 application.config.php 應用設定檔,初始化完成後調用 run() 方法運行架構。

 

ZendFramework2 源碼分析 index.php

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.