Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/think/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -1875,11 +1875,15 @@ public function setAction(string $action)
* 获取当前的控制器名
* @access public
* @param bool $convert 转换为小写
* @param bool $prefix 去除多层控制器前缀
* @return string
*/
public function controller(bool $convert = false): string
public function controller(bool $convert = false, bool $prefix = false): string
{
$name = $this->controller ?: '';
if ($prefix and strpos($name, '.')) {
$name = substr($name, strripos($name, '.') + 1);
}
return $convert ? strtolower($name) : $name;
}

Expand Down