CodeIgniter Source Code Analysis (ii) entry file index.php

Source: Internet
Author: User
Tags codeigniter

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.