CI内部是如何获得index.php后边的control还有方法,以及参数的
CI内部是如何获得index.php后边的control还有方法,以及参数的?是哪个文件处理的,大约那多少行啊。
在接触CI之前都是用问号传值方式,用CI已经好长时间了,忽然想起来,CI这种传值方式是个什么原理。
CI内部实际通过
core.codegniter
call_user_func_array(array(&$CI, $method), array_slice($URI->rsegments, 2));这块代码来执行你的脚本
路由这块分别通过
core.route
_set_routing 读取路由信息
_validate_request 判断当前路由是否有效
大道达人 发表于 2012-3-20 09:26 static/image/common/back.gif
CI内部实际通过
core.codegniter
call_user_func_array(array(&$CI, $method), array_slice($URI->rsegment ...
实际上我是在想 我在index.php里有什么办法读到index.php后边的值 kissgxd 发表于 2012-3-20 14:25 static/image/common/back.gif
实际上我是在想 我在index.php里有什么办法读到index.php后边的值
你想实现什么功能吧? 分割url应该可以实现 大道达人 发表于 2012-3-20 16:55 static/image/common/back.gif
你想实现什么功能吧?
打算 发现不合适的参数,直接在index.php 里exit kissgxd 发表于 2012-3-20 21:11 static/image/common/back.gif
打算 发现不合适的参数,直接在index.php 里exit
/*你可以在构造函数里面封装下*/
public function __construct()
{
parent::__construct();
/*Catch URL 读取当前 URL的信息*/
$this->template['url'] = $this->router->fetch_method();
$this->template['class'] = $this->router->fetch_class();
/*hack 可以屏蔽到未加载的章节*/
if ( ! in_array($this->router->fetch_method(),$this->available_manual))
{
Message::set('亲..'.$this->router->fetch_method().'章节正在撰写','info');
redirect('/doc/start');
}
/*消息提示*/
Message::set('亲..,CI学习,就此拉开帷幕','info');
}
URL可以直接参考这个站点http://cier.phpfogapp.com/index.php/docs/start/basic/chapter02
大道达人 发表于 2012-3-20 21:22 static/image/common/back.gif
/*你可以在构造函数里面封装下*/
public function __construct()
{
不错不错,思路清晰了! 大道达人 发表于 2012-3-20 21:22 static/image/common/back.gif
/*你可以在构造函数里面封装下*/
public function __construct()
{
可以说一下 $this->router->fetch_method(); $this->router->fetch_class();你是在哪里找到的么?手册里好像是没有的。 kissgxd 发表于 2012-3-21 15:34 static/image/common/back.gif
可以说一下 $this->router->fetch_method(); $this->router->fetch_class();你是在哪里找到的么?手册里 ...
CI_Route里面的原装方法啊
页:
[1]