protected function getNode(){
//$CONTROLLER_NAME = $this->_CI->router->fetch_class();
//$ACTION_NAME = $this->_CI->router->fetch_method(); // 當前使用方法
//$this->node = strtolower($CONTROLLER_NAME.'/'.$ACTION_NAME);
$file=str_replace("/index.php","",$_SERVER['PHP_SELF']);
$reg="/\/\d+/is";
$file= preg_replace($reg,"",$file);
if(substr($file,strlen($file)-1,1)=="/"){
$file=substr($file,0,strlen($file)-1);
}
if(!empty($file)){
$this->node = $file;
}else{
//兼容
$this->node = $this->getNodeByRouter();
}
}
/**
* _CI->router 獲取url節點
* test
* @return string
*/
protected function getNodeByRouter(){
$CONTROLLER_NAME = $this->_CI->router->fetch_class();
$ACTION_NAME = $this->_CI->router->fetch_method();
$node = '/'.$CONTROLLER_NAME.'/'.$ACTION_NAME;
// print_r($node);die;
return $node ;
}
mac 無法兼容原始方法所以改寫
$CONTROLLER_NAME = $this->_CI->router->fetch_class();
$ACTION_NAME = $this->_CI->router->fetch_method();
$node = '/'.$CONTROLLER_NAME.'/'.$ACTION_NAME;
以獲取路由