CodeIgniter 的那些事




      黄波           30 分钟
CodeIgniter 是什么
CodeIgniter is a powerful PHP framework
with a very small footprint, built for PHP
coders who need a simple and elegant
toolkit to create full-featured web
applications. If you‘re a developer who
lives in the real world of shared hosting
accounts and clients with deadlines, and if
you’re tired of ponderously large and
thoroughly undocumented frameworks.


                CodeIgniter 的那些事
CodeIgniter 的背景 / 历史

CodeIgniter 最开始是由 Rick Ellis 开发的,他曾经是
一个摇滚音乐家,现在是一名程序员。


当年由于 Ellis 未能找到一个简单的 PHP 框架,健
壮、易于使用、文档完整,包含建立一个完整应用需要
的所有工具,并且有一个以浏览器为基础的界面,使用
普通用户权限就能安装。没有别的原因,就是“市场需
要”这个单一的原因促使我想开发这样一个框架产品。



              CodeIgniter 的那些事
CI 的特点

 轻量、强大、高效

 文档齐全、易于学习、开发快速、易配置

 功能类库丰富、大量的第三方类库支持



         CodeIgniter 的那些事
学习 CI




        CodeIgniter 的那些事
从 CI 中学习




       CodeIgniter 的那些事
CI 的构架

Design and Architectural Goals
Our goal for CodeIgniter is maximum performance, capability, and
flexibility in the smallest, lightest possible package.


特性
 dynamically instantiated
 loosely coupled
 high component singularity


                             CodeIgniter 的那些事
CI 的构架




         CodeIgniter 的那些事
CI 的构架 -MVC
Model
  和各种数据源打交道,包含但不限于数据库的数据,建立数据源与 php
  变量的关联


View
  表现给用户看的内容, CI 使用的是原生态的 php 作为 html 模板,效率
  很高


Controller
  处理业务逻辑,协调 Model 的工作,支持 View 的工作,以实现业务请
  求
                CodeIgniter 的那些事
CI 的构架 - 单入口文件

对所有请求都能有效的初始化所需资源,包括安
全处理。
CI 并不是强制的只有一个文件,而是一个应用
程序只有唯一的入口。
CI 中 index.php 文件的第一个 PHP 语句设置就
是当前所在的运行环境。

            CodeIgniter 的那些事
CI 的构架 - 应用与系统文件的分离




        CodeIgniter 的那些事
CI 的构架 - 可扩展性(文件)
扩展方式
  创建全新的
  扩展原始的 前缀 MY_
  替换原始的 前缀 CI_


CI 框架的自身大部分组件可以被扩展
 Library, Core class
 Drivers
 Helpers


                        CodeIgniter 的那些事
CI 的构架 -CI   的可扩展性( Hooks )
在不修改 CI 系统文件的情况下运行自己所需的函数或方法以实现修
改 CI 工作流程的目的,需要配置开启 hook




             CodeIgniter 的那些事
CI 的构架 - 支持多种数据库平台
  MySql
  Postgre
  MSSql
  OCI
  ODBC
  SqLite


             CodeIgniter 的那些事
CI 的工作流程




       CodeIgniter 的那些事
CI 框架体现的 web 程序的要素
刚才给出的流程图中直接体现了一些要
素, MVC 、 Security 、 cache 、 libraries 、 helpers 等
等,以下是没有上图未出现的要素却贯穿了整个 CI 的运
行。




                  CodeIgniter 的那些事
Just do IT




CodeIgniter 的那些事
CodeIgniter 中国社区 ID : BruceWolf
Email:BruceWolf@CodeIgniter.org.cn
      iBruceWolf@Gmail.com

2011 php技术高峰论坛演讲.黄波

  • 1.
    CodeIgniter 的那些事 黄波 30 分钟
  • 2.
    CodeIgniter 是什么 CodeIgniter isa powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications. If you‘re a developer who lives in the real world of shared hosting accounts and clients with deadlines, and if you’re tired of ponderously large and thoroughly undocumented frameworks. CodeIgniter 的那些事
  • 3.
    CodeIgniter 的背景 /历史 CodeIgniter 最开始是由 Rick Ellis 开发的,他曾经是 一个摇滚音乐家,现在是一名程序员。 当年由于 Ellis 未能找到一个简单的 PHP 框架,健 壮、易于使用、文档完整,包含建立一个完整应用需要 的所有工具,并且有一个以浏览器为基础的界面,使用 普通用户权限就能安装。没有别的原因,就是“市场需 要”这个单一的原因促使我想开发这样一个框架产品。 CodeIgniter 的那些事
  • 4.
    CI 的特点  轻量、强大、高效 文档齐全、易于学习、开发快速、易配置  功能类库丰富、大量的第三方类库支持 CodeIgniter 的那些事
  • 5.
    学习 CI CodeIgniter 的那些事
  • 6.
    从 CI 中学习 CodeIgniter 的那些事
  • 7.
    CI 的构架 Design andArchitectural Goals Our goal for CodeIgniter is maximum performance, capability, and flexibility in the smallest, lightest possible package. 特性  dynamically instantiated  loosely coupled  high component singularity CodeIgniter 的那些事
  • 8.
    CI 的构架 CodeIgniter 的那些事
  • 9.
    CI 的构架 -MVC Model 和各种数据源打交道,包含但不限于数据库的数据,建立数据源与 php 变量的关联 View 表现给用户看的内容, CI 使用的是原生态的 php 作为 html 模板,效率 很高 Controller 处理业务逻辑,协调 Model 的工作,支持 View 的工作,以实现业务请 求 CodeIgniter 的那些事
  • 10.
    CI 的构架 -单入口文件 对所有请求都能有效的初始化所需资源,包括安 全处理。 CI 并不是强制的只有一个文件,而是一个应用 程序只有唯一的入口。 CI 中 index.php 文件的第一个 PHP 语句设置就 是当前所在的运行环境。 CodeIgniter 的那些事
  • 11.
    CI 的构架 -应用与系统文件的分离 CodeIgniter 的那些事
  • 12.
    CI 的构架 -可扩展性(文件) 扩展方式 创建全新的 扩展原始的 前缀 MY_ 替换原始的 前缀 CI_ CI 框架的自身大部分组件可以被扩展 Library, Core class Drivers Helpers CodeIgniter 的那些事
  • 13.
    CI 的构架 -CI 的可扩展性( Hooks ) 在不修改 CI 系统文件的情况下运行自己所需的函数或方法以实现修 改 CI 工作流程的目的,需要配置开启 hook CodeIgniter 的那些事
  • 14.
    CI 的构架 -支持多种数据库平台  MySql  Postgre  MSSql  OCI  ODBC  SqLite CodeIgniter 的那些事
  • 15.
    CI 的工作流程 CodeIgniter 的那些事
  • 16.
    CI 框架体现的 web程序的要素 刚才给出的流程图中直接体现了一些要 素, MVC 、 Security 、 cache 、 libraries 、 helpers 等 等,以下是没有上图未出现的要素却贯穿了整个 CI 的运 行。 CodeIgniter 的那些事
  • 17.
  • 18.