当前位置 : 主页 > 网络编程 > PHP >

tp3框架获取当前控制器名

来源:互联网 收集:自由互联 发布时间:2021-06-28
gistfile1.txt /** * 获取当前Action名称 * @access protected */protected function getActionName() { if(empty($this-name)) { // 获取Action名称 $offset=strrpos(get_class($this), '\\', -10); // 从尾部第 10 个位置开始查找 $th
gistfile1.txt
/**
	 * 获取当前Action名称
	 * @access protected
	 */
	protected function getActionName() {
	    if(empty($this->name)) {
	        // 获取Action名称
	        $offset=strrpos(get_class($this), '\\', -10);  // 从尾部第 10 个位置开始查找
	        $this->name     =   substr(get_class($this),$offset+1,-10);
	    }
	    return $this->name;
	}
网友评论