PHP 8.6.0 Beta 3 is available for testing

Yaf_Controller_Abstract::getView

(Yaf >=1.0.0)

Yaf_Controller_Abstract::getView获取视图引擎

说明

public function Yaf_Controller_Abstract::getView(): ?Yaf_View_Interface

返回绑定到该控制器的视图引擎。

参数

此函数没有参数。

返回值

Yaf_View_Interface 实例,如果没有可用的视图引擎则返回 null

示例

示例 #1 Yaf_Controller_Abstract::getView() 示例

<?php
class ProductController extends Yaf_Controller_Abstract
{
    public function indexAction() {
        $view = $this->getView();

        // 把 $products 导出到模板 product/index.phtml
        $view->assign("products", array("yaf", "php"));
    }
}
?>

参见

添加备注

用户贡献的备注

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