1<?PHP2 3 /*Setting the Environment*/4 Define(' Environment ', ' development ');5 6 if(defined(' Environment '))7 {8 Switch(Environment)9 {Ten Case' Development ': One error_reporting(E_all); A Break; - - Case' Testing ': the Case' Production ': - error_reporting(0); - Break; - + default: - Exit(' The application environment is not set correctly. '); + } A } at - /*System Folder name*/ - $system _path= ' System '; - - /*Apply folder name*/ - $application _folder= ' Application '; in - //change the current directory to the specified directory to if(defined(' STDIN ')) + { - chdir(dirname(__file__)); the } * $ if(Realpath($system _path) !==FALSE)//return Absolute PathPanax Notoginseng { - $system _path=Realpath($system _path).‘ /‘; the } + A //system Path the $system _path=RTrim($system _path, ‘/‘).‘ /‘; + - $ if( !Is_dir($system _path)) $ { - Exit("System file path setting error"); - } the //the name of the current file - Define(' Self ',PathInfo(__file__,pathinfo_basename));Wuyi the //file name extension - Define(' EXT ', '. php '); Wu - //Path to the system folder About Define(' BasePath ',Str_replace("\\", "/",$system _path)); $ - //Path to the front controller (this file) - Define(' Fcpath ',Str_replace(Self, ",__file__)); - A //Name of the "System Folder" + Define(' Sysdir ',Trim(STRRCHR(Trim(BasePath, '/'), '/'), '/')); the - //the path to the "Application" folder $ if(Is_dir($application _folder)) the { the Define(' APPPATH ',$application _folder.‘ /‘); the } the Else - { in if( !Is_dir(BasePath.$application _folder.‘ /‘)) the { the Exit("App Folder settings Error"); About } the the Define(' APPPATH ', basepath.$application _folder.‘ /‘); the } + - /* the * --------------------------------------------------------------------Bayi * LOAD the BOOTSTRAP FILE the * -------------------------------------------------------------------- the * - * and Away we go ... - * the */ the require_onceBasePath. ' Core/codeigniter.php '; the the /*End of File index.php*/ - /*Location :./index.php*/
View Code
This file is mainly about setting up the project run environment
Set System system Directory
Set some constants: Self, EXT, basepath ...
CodeIgniter Source Code Analysis (ii) entry file index.php