2024 年日本 PHP 研討會

Yaf_View_Simple::__construct

(Yaf >=1.0.0)

Yaf_View_Simple::__constructYaf_View_Simple 的建構函式

說明

final public Yaf_View_Simple::__construct(字串 $template_dir, 陣列 $options = ?)

參數

template_dir

模板的基底目錄,預設為 Yaf 的 APPLICATOIN . "/views"。

options

Options for the engine, as of Yaf 2.1.13, you can use short tag
      "<?=$var?>" in your template(regardless of "short_open_tag"), 
      so comes a option named "short_tag",  you can switch this off 
      to prevent use short_tag in template.

範例

範例 #1 Yaf_View_Simple::__construct() 範例

<?php
define
("TEMPLATE_DIRECTORY", APPLICATOIN_PATH . '/views');
$view = new Yaf_View_Simple(TEMPLATE_DIRECTORY, array(
'short_tag' => false //不允許在樣板中使用短標籤
));
?>
新增註記

使用者貢獻的註記

此頁面沒有使用者貢獻的註記。
To Top