当前位置: 首页 > news >正文

杭州做网站多少钱地推扫码平台

杭州做网站多少钱,地推扫码平台,网站广告接入,讯美 深圳网站建设为什么选择CI 官网给出的理由 你想要一个小巧的框架;你需要出色的性能;你需要广泛兼容标准主机上的各种 PHP 版本和配置;你想要一个几乎零配置的框架;你想要一个不需使用命令行的框架;你想要一个不想被编码规则的条条框…

为什么选择CI 官网给出的理由

  • 你想要一个小巧的框架;
  • 你需要出色的性能;
  • 你需要广泛兼容标准主机上的各种 PHP 版本和配置;
  • 你想要一个几乎零配置的框架;
  • 你想要一个不需使用命令行的框架;
  • 你想要一个不想被编码规则的条条框框限制住的框架;
  • 你对 PEAR 这种庞然大物不感兴趣;
  • 你不想被迫学习一种新的模板语言(当然如果你喜欢,你可以选择一个模板解析器);
  • 你不喜欢复杂,追求简单;
  • 你需要清晰、完整的文档。

如果你用php 开发那么你一定希望程序能够快速,稳定,简单的搭建起来,相比其他框架CI 太简单了。

CI是一个入门框架。

CI 小巧精简也确定了他比其他框架快一点点。

0x01.入口文件定义了一堆常量  ,最后引入核心文件

 

 require_once BASEPATH.'core/CodeIgniter.php';

 

0x002.在 CodeIgniter.php中拦截一些报错

 

        set_error_handler('_error_handler');set_exception_handler('_exception_handler');register_shutdown_function('_shutdown_handler');

  

   建立我们的主角 CI_Controller.然后大臣们也开始工作并注入到容器中.CI_Controller要做的就是控制反转。所以你可以在  controller 中使用  $this->input->get('');

$BM =& load_class('Benchmark', 'core');
$EXT =& load_class('Hooks', 'core');
$CFG =& load_class('Config', 'core');
$UNI =& load_class('Utf8', 'core');
$URI =& load_class('URI', 'core');
$OUT =& load_class('Output', 'core');
$IN	=& load_class('Input', 'core');
$SEC =& load_class('Security', 'core');
$LANG =& load_class('Lang', 'core');

0x03.Router 开始工作

	$e404 = FALSE;$class = ucfirst($RTR->class);$method = $RTR->method;if (empty($class) OR ! file_exists(APPPATH.'controllers/'.$RTR->directory.$class.'.php')){$e404 = TRUE;}else{require_once(APPPATH.'controllers/'.$RTR->directory.$class.'.php');if ( ! class_exists($class, FALSE) OR $method[0] === '_' OR method_exists('CI_Controller', $method)){$e404 = TRUE;}elseif (method_exists($class, '_remap')){$params = array($method, array_slice($URI->rsegments, 2));$method = '_remap';}elseif ( ! method_exists($class, $method)){$e404 = TRUE;}/*** DO NOT CHANGE THIS, NOTHING ELSE WORKS!** - method_exists() returns true for non-public methods, which passes the previous elseif* - is_callable() returns false for PHP 4-style constructors, even if there's a __construct()* - method_exists($class, '__construct') won't work because CI_Controller::__construct() is inherited* - People will only complain if this doesn't work, even though it is documented that it shouldn't.** ReflectionMethod::isConstructor() is the ONLY reliable check,* knowing which method will be executed as a constructor.*/elseif ( ! is_callable(array($class, $method))){$reflection = new ReflectionMethod($class, $method);if ( ! $reflection->isPublic() OR $reflection->isConstructor()){$e404 = TRUE;}}}if ($e404){if ( ! empty($RTR->routes['404_override'])){if (sscanf($RTR->routes['404_override'], '%[^/]/%s', $error_class, $error_method) !== 2){$error_method = 'index';}$error_class = ucfirst($error_class);if ( ! class_exists($error_class, FALSE)){if (file_exists(APPPATH.'controllers/'.$RTR->directory.$error_class.'.php')){require_once(APPPATH.'controllers/'.$RTR->directory.$error_class.'.php');$e404 = ! class_exists($error_class, FALSE);}// Were we in a directory? If so, check for a global overrideelseif ( ! empty($RTR->directory) && file_exists(APPPATH.'controllers/'.$error_class.'.php')){require_once(APPPATH.'controllers/'.$error_class.'.php');if (($e404 = ! class_exists($error_class, FALSE)) === FALSE){$RTR->directory = '';}}}else{$e404 = FALSE;}}// Did we reset the $e404 flag? If so, set the rsegments, starting from index 1if ( ! $e404){$class = $error_class;$method = $error_method;$URI->rsegments = array(1 => $class,2 => $method);}else{show_404($RTR->directory.$class.'/'.$method);}}if ($method !== '_remap'){$params = array_slice($URI->rsegments, 2);}

这个代码是从  配置中读取路由参数,然后根据uri 将请求路由到指定的  action 中,将逻辑交由action处理。

这个  action是被定义到继承CI_Controller的控制类中,所以他可以通过 $this 使用全局已经注入的依赖。

依赖注入。

0X04.非Controller中如何使用依赖,答案是还是通过CI_Controller。

get_instance() 可以直接拿到这个容器。可以在common.php 中使用依赖方法。 

function &get_instance(){return CI_Controller::get_instance();}

  就连CI中的Model 也是从CI_Controller中找依赖database

转载于:https://www.cnblogs.com/yang95/articles/9259823.html

http://www.lbrq.cn/news/2512297.html

相关文章:

  • 新开传奇网站合击黑马it培训班出来现状
  • 商城网站源码下载昆山seo网站优化软件
  • 深圳网站建设哪家比较好江苏网页设计
  • 武汉建设网官方网站标题seo是什么意思
  • 苏州做网站推广的成都做整站优化
  • 如何做网站运营呢关键词seo培训
  • 北京网站开发优选ls20227推广计划方案模板
  • wordpress 插件复制山西seo
  • 搜集关键词的网站站长统计app软件
  • 网站设计方式如何进行搜索引擎优化 简答案
  • 租空间做网站系统优化软件哪个好
  • 在阿里巴巴上做网站需要什么条件网站怎样才能在百度被搜索到
  • 企业 宣传 还要网站吗信阳seo优化
  • 进入网站服务器怎么做楼市最新消息
  • 网站后台分析图怎么做广告公司怎么找客户资源
  • 原油可以取什么做标题发网站友情链接实例
  • 北京网站开发学习陕西新闻今日头条
  • 做企业网站的合同泰州seo平台
  • ui作品集 网站怎么做媒体平台推广
  • 外贸网站模板免费下载微商软文
  • 网站建设骗子百度信息流代运营
  • 做超市商品海报免费海报模版网站100个成功营销案例
  • 赣县区建设局网站优化公司怎么优化网站的
  • 集团网站建设服务公司广告制作公司
  • 做网站蓝色和什么颜色搭配好看百度公司全称
  • 专业电子科技网站建设百度助手安卓版下载
  • 今天发生的国际新闻seo到底是什么
  • 网站建设外包需要多少钱seo技术蜘蛛屯
  • php动态网站开发 唐四薪西安百度提升优化
  • 建设部网站1667号公告百度快照投诉
  • P1098 [NOIP 2007 提高组] 字符串的展开
  • 在CSS中,如果你想设置一个元素的高度(height)与其宽度(width)相匹配,但又希望宽度使用百分比来定义,你可以通过几种方式来实现。
  • XML Schema 指示器:全面解析与深度应用
  • xgboost 机器学习在生物信息学中的应用
  • Linux内核设计与实现 - 课程大纲
  • [Linux入门] 初学者入门:Linux DNS 域名解析服务详解