CodeIgniter源码分析(二) 入口文件index.php
2014-12-16 18:15
711 查看
<?php /* 设定环境 */ define('ENVIRONMENT', 'development'); 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_path = 'system'; /* 应用文件夹名 */ $application_folder = 'application'; // 把当前的目录改变为指定的目录 if (defined('STDIN')) { chdir(dirname(__FILE__)); } if (realpath($system_path) !== FALSE) //返回绝对路径 { $system_path = realpath($system_path).'/'; } // 系统路径 $system_path = rtrim($system_path, '/').'/'; if ( ! is_dir($system_path)) { exit("系统文件路径设置错误"); } //当前文件的名字 define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME)); //文件扩展名 define('EXT', '.php'); // Path to the system folder define('BASEPATH', str_replace("\\", "/", $system_path)); // Path to the front controller (this file) define('FCPATH', str_replace(SELF, '', __FILE__)); // Name of the "system folder" define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/')); // The path to the "application" folder if (is_dir($application_folder)) { define('APPPATH', $application_folder.'/'); } else { if ( ! is_dir(BASEPATH.$application_folder.'/')) { exit("应用文件夹设置错误"); } define('APPPATH', BASEPATH.$application_folder.'/'); } /* * -------------------------------------------------------------------- * LOAD THE BOOTSTRAP FILE * -------------------------------------------------------------------- * * And away we go... * */ require_once BASEPATH.'core/CodeIgniter.php'; /* End of file index.php */ /* Location: ./index.php */
View Code
该文件主要是设置项目运行环境
设置系统系统目录
设置部分常量:SELF、EXT、BASEPATH...
相关文章推荐
- CodeIgniter框架——源码分析之入口文件index.php
- CI框架源码完全分析之入口文件index.php
- CodeIgniter框架源码学习之框架入口文件--index.php
- DEDE源码分析与学习---index.php文件解读。
- CodeIgniter框架源码笔记(2)——请求的接收者:框架入口index.php
- CI框架源码解读(1)-入口文件index.php
- CodeIgniter源码分析之index.php
- CI框架入口文件index.php文件分析 推荐
- mediawiki源码分析-入口Index.php简要分析
- Yii2底层源码解读系列之一 入口文件index.php
- CI框架源码完全分析之核心文件Codeigniter.php
- CodeIgniter源码分析之index.php
- codeigniter源代码分析之入口文件 index.php
- 【ci框架】单一入口文件index.php分析
- CI 框架源码 入口文件 index.php 即程序开始执行的地方
- CI框架源码完全分析之核心文件Codeigniter.php
- CodeIgniter 核心代码阅读-入口文件index.php
- DEDE源码分析与学习--index.php文件解读
- CI框架源码解析一之入口文件index.php
- discuz入口文件index.php的思想分析