CodeIgniter中Router类的两个方法
生活随笔
收集整理的這篇文章主要介紹了
CodeIgniter中Router类的两个方法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
2019獨角獸企業重金招聘Python工程師標準>>>
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);?
?
?
?
轉載于:https://my.oschina.net/u/3901362/blog/2054360
總結
以上是生活随笔為你收集整理的CodeIgniter中Router类的两个方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python中字母大小写的转换,和一些字
- 下一篇: Qt之QSlider