如何获取ThinkPHP3.2框架中当前访问的控制器名称?
- 内容介绍
- 文章标签
- 相关推荐
本文共计87个文字,预计阅读时间需要1分钟。
plaintextgistfile1.txt/* 获取当前Action名称 @access protectedfunction getActionName() { if (empty($this->name)) { // 获取Action名称 $offset=strrpos(get_class($this), '\\', -10); // 从尾部第10个位置开始查找 $th=substr(get_class($this), $offset + 1); }}
/** * 获取当前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; }
本文共计87个文字,预计阅读时间需要1分钟。
plaintextgistfile1.txt/* 获取当前Action名称 @access protectedfunction getActionName() { if (empty($this->name)) { // 获取Action名称 $offset=strrpos(get_class($this), '\\', -10); // 从尾部第10个位置开始查找 $th=substr(get_class($this), $offset + 1); }}
/** * 获取当前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; }

