如何使用tp3框架查询当前访问的控制器名称?
- 内容介绍
- 文章标签
- 相关推荐
本文共计90个文字,预计阅读时间需要1分钟。
plaintextgistfile1.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);** }** }**
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; }
本文共计90个文字,预计阅读时间需要1分钟。
plaintextgistfile1.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);** }** }**
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; }

