学习任何一款程序,最终极的方法及时阅读源代码。写这个(CI框架代码分析)主要是想学习下,CI框架的实现原理是什么。自己也用过CI做过点小东西。感觉CI小巧,优雅 ,高效 ,很值得认真学习一下。这是第0篇,只想简单的看看,ci默认是怎么执行的。本系列代码的分析也仅仅这个运行过程。

CI的版本采用最新的 3.1.2 版本。

第一个看点,就是看看默认的加载了几个文件。

通过修改默认的文件
file: application/controllers/Welcome.php

public function index() {
    var_dump(get_included_files())
}

查看运行的文件,这里直接给出结果

array(26) {
  [0]=>
  string(26) "/www.hiloong.com/index.php"
  [1]=>
  string(44) "/www.hiloong.com/system/core/CodeIgniter.php"
  [2]=>
  string(49) "/www.hiloong.com/application/config/constants.php"
  [3]=>
  string(39) "/www.hiloong.com/system/core/Common.php"
  [4]=>
  string(46) "/www.hiloong.com/application/config/config.php"
  [5]=>
  string(42) "/www.hiloong.com/system/core/Benchmark.php"
  [6]=>
  string(38) "/www.hiloong.com/system/core/Hooks.php"
  [7]=>
  string(39) "/www.hiloong.com/system/core/Config.php"
  [8]=>
  string(36) "/www.hiloong.com/system/core/Log.php"
  [9]=>
  string(48) "/www.hiloong.com/system/core/compat/mbstring.php"
  [10]=>
  string(44) "/www.hiloong.com/system/core/compat/hash.php"
  [11]=>
  string(48) "/www.hiloong.com/system/core/compat/password.php"
  [12]=>
  string(48) "/www.hiloong.com/system/core/compat/standard.php"
  [13]=>
  string(37) "/www.hiloong.com/system/core/Utf8.php"
  [14]=>
  string(36) "/www.hiloong.com/system/core/URI.php"
  [15]=>
  string(39) "/www.hiloong.com/system/core/Router.php"
  [16]=>
  string(46) "/www.hiloong.com/application/config/routes.php"
  [17]=>
  string(39) "/www.hiloong.com/system/core/Output.php"
  [18]=>
  string(45) "/www.hiloong.com/application/config/mimes.php"
  [19]=>
  string(41) "/www.hiloong.com/system/core/Security.php"
  [20]=>
  string(38) "/www.hiloong.com/system/core/Input.php"
  [21]=>
  string(37) "/www.hiloong.com/system/core/Lang.php"
  [22]=>
  string(43) "/www.hiloong.com/system/core/Controller.php"
  [23]=>
  string(52) "/www.hiloong.com/application/controllers/Welcome.php"
  [24]=>
  string(39) "/www.hiloong.com/system/core/Loader.php"
  [25]=>
  string(48) "/www.hiloong.com/application/config/autoload.php"
}

可以看到一共加载了26个文件,这26个文件,就是重点的分析对象。 可以看到所有的文件都来自两个目录 system,application。前者是CI的框架目录, 后者是用户程序目录,包括用户的配置信息等。

标签: none

已有 10 条评论

  1. 上海网站建设

    感谢分享

  2. 自媒体运营

    不错,必须顶一下!

  3. 头条新闻

    文章不错支持一下

  4. 跨境电商卖家

    现在才发觉我要学的东西要好多啊

  5. lnog

    大佬!厉害啊!

  6. 阿Q博客

    在做东小店一天130多

  7. 今日头条新闻

    文章还不错支持一下

  8. 热搜

    文章不错非常喜欢

  9. 八角网赚站

    路过,支持一下

  10. 馨香羽灵

    博主的文笔很不错,仰慕已久,特来拜会。若能有幸能得到博主的回访,必将欣喜若狂。

添加新评论