PHP 8.6.0 Beta 3 is available for testing

Yaf_Request_Abstract::getControllerName

(Yaf >=1.0.0)

Yaf_Request_Abstract::getControllerName获取控制器名称

说明

public function Yaf_Request_Abstract::getControllerName(): ?string

获取控制器名称

参数

此函数没有参数。

返回值

控制器名称;如果未设置,则返回 null

示例

示例 #1 Yaf_Request_Abstract::getControllerName() 示例

<?php
class ProductController extends Yaf_Controller_Abstract
{
    public function viewAction()
    {
        // 假设请求是 /product/view/id/17
        var_dump($this->getRequest()->getControllerName());
    }
}
?>

以上示例的输出类似于:

string(7) "Product"

参见

添加备注

用户贡献的备注

此页面尚无用户贡献的备注。
To Top