CodeIgniter源碼分析(二) 入口檔案index.php

來源:互聯網
上載者:User

標籤:style   blog   http   ar   io   color   os   sp   on   

 1 <?php 2  3 /* 設定環境 */ 4 define(‘ENVIRONMENT‘, ‘development‘); 5  6 if (defined(‘ENVIRONMENT‘)) 7 { 8     switch (ENVIRONMENT) 9     {10         case ‘development‘:11             error_reporting(E_ALL);12         break;13     14         case ‘testing‘:15         case ‘production‘:16             error_reporting(0);17         break;18 19         default:20             exit(‘The application environment is not set correctly.‘);21     }22 }23 24 /* 系統檔案夾名 */25 $system_path = ‘system‘;26 27 /* 應用檔案夾名 */28 $application_folder = ‘application‘;29 30 // 把當前的目錄改變為指定的目錄31 if (defined(‘STDIN‘))32 {33     chdir(dirname(__FILE__));34 }35 36 if (realpath($system_path) !== FALSE)        //返回絕對路徑37 {38     $system_path = realpath($system_path).‘/‘;39 }40 41 // 系統路徑42 $system_path = rtrim($system_path, ‘/‘).‘/‘;43 44 45 if ( ! is_dir($system_path))46 {47     exit("系統檔案路徑設定錯誤");48 }49     //當前檔案的名字50     define(‘SELF‘, pathinfo(__FILE__, PATHINFO_BASENAME));51 52     //副檔名53     define(‘EXT‘, ‘.php‘);54 55     // Path to the system folder56     define(‘BASEPATH‘, str_replace("\\", "/", $system_path));57 58     // Path to the front controller (this file)59     define(‘FCPATH‘, str_replace(SELF, ‘‘, __FILE__));60 61     // Name of the "system folder"62     define(‘SYSDIR‘, trim(strrchr(trim(BASEPATH, ‘/‘), ‘/‘), ‘/‘));63 64     // The path to the "application" folder65     if (is_dir($application_folder))66     {67         define(‘APPPATH‘, $application_folder.‘/‘);68     }69     else70     {71         if ( ! is_dir(BASEPATH.$application_folder.‘/‘))72         {73             exit("應用檔案夾設定錯誤");74         }75 76         define(‘APPPATH‘, BASEPATH.$application_folder.‘/‘);77     }78 79 /*80  * --------------------------------------------------------------------81  * LOAD THE BOOTSTRAP FILE82  * --------------------------------------------------------------------83  *84  * And away we go...85  *86  */87 require_once BASEPATH.‘core/CodeIgniter.php‘;88 89 /* End of file index.php */90 /* Location: ./index.php */
View Code

該檔案主要是設定項目運行環境

設定系統系統目錄

設定部分常量:SELF、EXT、BASEPATH...

CodeIgniter源碼分析(二) 入口檔案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.