CI(-)框架结构

一 CI 是什么

1 CodeIgniter is an Application Development Framework - a toolkit -
2 for people who build web sites using PHP. 
3 Its goal is to enable you to develop projects much faster than you could if you were writing code from scratch, 
4 by providing a rich set of libraries for commonly needed tasks,
5 as well as a simple interface and logical structure to access these libraries. 
6 CodeIgniter lets you creatively focus on your project by minimizing the amount of code needed for a given task.

  官网的解释很清楚.CI 是toolkit 工具包,工具包就是有小而全的工具特性.set of libraries ,这里set让三爷我联想到了redis 的set,卧槽真是个好东西啊,libraries就是

这些小工具. CI 用简单的接口和逻辑把 这些工具组合起来.使你可以减少开发的工作量.

二 目录结构

1 index.php     ----------入口文件
2 application   ----------应用程序文件夹
3 system        ----------框架目录
4 user_guide    ----------手册

system 目录

core     -------- 核心类目    
       Benchmark.php      -------- 基准测试类    
       CodeIgniter.php     -------- 框架初始文件
       Common.php        -------- 公共函数库
       Config.php            -------- 配置文件    
       Controller.php        -------- 所有库文件继承的超类
       Exceptions.php      -------- 异常处理类
       Hooks.php            -------- 钩子
       Input.php             -------- 输入数据处理类
       Lang.php              -------- 语言类 
       Loader.php            -------- 加载类,加载文件,
       Model.php             -------- 基类模型文件
       Output.php           --------- 输出处理文件
       Router.php            --------- 路由处理类
       Security.php          --------- 安全基类
       URI.php               --------- 解析URI
       Utf8.php               -------- 提供Utf8 的环境
database    -------- 
        DB.php                -------- 初始化数据库类
        DB_cache.php       -------- 数据库缓存类
        DB_active_rec.php -------- AR基类
        DB_driver.php       -------- DB 配置
        DB_forge.php       -------- 数据操作类
        DB_result.php       -------- 数据操作结果类
        DB_utility.php       -------- 数据库优化处理类
helpers  --------            各种数据类型处理函数
        array_helper.php        
        cookie_helper.php
        directory_helper.php
        file_helper.php
        form_helper.php
        html_helper.php
        number_helper.php
        path_helper.php
        text_helper.php
        url_helper.php
        xml_helper.php
        string_helper.php
        typograpthy_helper.php   --------  类型转换
        smiley_helper.php    ---------  JS处理
        captcha_helper.php    -------- 验证码
libraries    --------        各种
        Cache  --------      缓存
        javascript  ---------      Jquery 类
        Calendar.php           -------- 日历
        Cart.php                 -------- 购物车
        Form_validation.php  -------- 表单验证类
        Migration.php            -------- 数据库的操作类事务类up/down
        Pagination.php         --------- 分页类
        Parser.php                ---------- 模板解析类
        Table.php                --------- 表格
        Trackback.php        ---------
        User_agent.php      --------- 
        Xml_rpc.php            --------

应用程序目录结构

1 models        --------  数据处理
2 views           --------  模板展示
3 logs            --------  日志存储
4 libraries       --------  库文件
5 helpers        --------  帮助函数
6 controllers    --------  逻辑处理
7 config          --------  app 配置类
8 cache          --------  缓存处理类

三 框架应用,

  文件放到根目录下,访问index.php即可.  

四   运行解析

  CI运行解析

  1.单入口文件index.php 初始化CI所需的基本资源  2.Router.php parse URIs,确定路由,(在routes.php进行remap APP层)

  3.存在缓存直接输出,不存在则Input.php处理请求字符

  4.app逻辑处理层 MVC

  5.渲染输出,如果开启缓存,先缓存.

五  MVC

  老生常谈了.总之,如果你认为M不是必须的可以不要它.但是开发框架的时候为了装13 用,一般还是留下的.

原文地址:https://www.cnblogs.com/liuyuxing/p/4995531.html