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;
以获取路由