file:
/* Location: ./system/core/Router.php */
第一个: 主要是获取当前请求的method,也就是controller下的action,
/**
* Fetch the current method
*
* @access public
* @return string
*/
function fetch_method()
{
if ($this->method == $this->fetch_class())
{
return 'index';
}
return $this->method;
}
第二个:主要是去当前访问的controller。
/**
* Fetch the current class
*
* @access public
* @return string
*/
function fetch_class()
{
return $this->class;
}
详情请看该类的代码。
因为这两个方法经常在做权限控制的时候需要用到,之前采用了如下的方式来取取得controller和method,不是很好。所以推荐使用上面的两个方法。
$this->CI->uri->segment(1);