<?php/**---------------------------------------------------------------* Application environment*------------ ---------------------------------------------------* *//Configure the environment in which the project runs, which affects the display of error reports and the reading of the configuration files. */define (' Environment ', ' development ');/**---------------------------------------------------------------* ERROR reporting*---------------------------------------------------------------**/if (defined (' environment ')) {switch ( Environment) {case ' development ': error_reporting (e_all), break;case ' testing ': case ' production ': error_reporting (0); Break;default:exit (' The application environment is not set correctly. ');}} /**---------------------------------------------------------------* SYSTEM FOLDER name*-------------------------- -------------------------------------* * * Set the SYSTEM directory */$system _path = ' system ';/**------------------------------------- --------------------------* Application FOLDER name*------------------------------------------------------------- --*** Setting the App directory */$application _folder = ' Application';/**--------------------------------------------------------------------* DEFAULT controller*------------------ The $routing that is set in this place--------------------------------------------------***///will have a redirection effect on the route. See: core/codeiginter.php//$routing [' directory '] = ';//$routing [' controller '] = ';//$routing [' function '] = ';/**--- ----------------------------------------------------------------* CUSTOM CONFIG values*-------------------------- ----------------------------------------* Here is a place to define configuration information. In fact, in index.php many places can be set up some configuration, like just above the $routing,* and the configuration information set here to take precedence over the configuration information set in the config/directory. *///$assign _to_config[' name_of_config_item '] = ' value of config item ';//------------------------------------------- -------------------------//END of USER configurable SETTINGS. Don't EDIT BELOW this line//--------------------------------------------------------------------/**--------------- ------------------------------------------------* Resolve The system path for increased reliability*----------------- ----------------------------------------------*///This please refer to: http://blog.163.com/wu_guoqing/blog/static/196537018201272512616394 /if (Defined (' STDIN ')) {chdir (dirname (__file__));} Calculates the $system_path, the path where the core file resides. The $path in Realpath ($path) must be a path that exists. if (Realpath ($system _path)!== FALSE) {$system _path = Realpath ($system _path). ' /‘;} Make sure to/end $system_path = RTrim ($system _path, '/'). ' /';//Determine if it is the correct directory if (! Is_dir ($system _path)) {exit ("Your system folder path does not appear to BES set correctly. Please open the following file and correct this: ". PathInfo (__file__, Pathinfo_basename));} /**-------------------------------------------------------------------* After configuring some file directory information above, define some constants according to these directories. *-------------------------------------------------------------------*///The file name of this portal file, is currently index.phpdefine (' self ', PathInfo (__file__, Pathinfo_basename));//File extension define (' EXT ', '. php ');//Unified with/For directory delimiter (default Yes/or \,linux under Windows is/) define ( ' BasePath ', str_replace ("\ \", "/", $system _path));//The directory where the front controller resides. In CI is this entry file. Define (' Fcpath ', str_replace (self, ',__FILE__);//Obtain the directory name of the core file, as follows://trim (Bashpath, '/'): first to trim the Bashpath, remove the end of the '/'//successively through the STRRCHR (XXX, '/'): Put the above-mentioned string, Truncate a substring at the beginning of the last '/' to the end. Finally trim (XXX, '/'), remove both ends of the '/', the essence here is to remove the left side of the '/'. Define (' Sysdir ', trim (STRRCHR (Trim (basepath, '/'), '/'), '/') ');//define the application file directory//See if the directory you are configuring is relative to the current file, and if so, you can define it successfully. if (Is_dir ($application _folder)) {define (' APPPATH ', $application _folder. ' /‘);} else{//if not, then determine whether the application directory exists relative to the core file directory. If not, then pull it down. if (! Is_dir (basepath. $application _folder. ' /')} {exit ("Your application Folder path does not appear to be set correctly. Please open the following file and correct this: ". self);} Define (' APPPATH ', BasePath. $application _folder. ' /‘);} /**--------------------------------------------------------------------* LOAD the BOOTSTRAP file*----------------- ---------------------------------------------------**///Essentially, this front-end controller and portal file is just the environment that defines the current project run and some constants, And the real macro-control effect is the following codeigniter.php. Require_once BasePath. ' Core/codeigniter.php ';/*** summarizes what this file does: * First, set up the current project's operating environment, which is mainly the error reporting settings, this is placed in the entire project to run the first place.* Second, the configuration of some directory information, these are certain developers can customize things. Then, depending on the configuration directory information, CI will define something that will be useful later as a constant *, why do you do this? Because in the future in many different places, such as CI in the various components will use the path-related information, where the unified calculation and definition, in the rear * to reference and modify. * Third, the introduction of codeigniter.php to work. * * Move to core/codeigniter.php:http://calixwu.com/2014/11/codeigniter-yuanmafenxi-codeigniter-php.html*/in the core file directory
CodeIgniter source code Analysis of index.php