从页面控制器中设置变量(例如页面标题标签)时,最佳实践是什么?
我有:
class About extends Controller {
public function Index()
{
$this->view->pageTitle = 'test 123' ;
$this->view->metaDescription = 'Description here' ;
$this->view->metaKeywords = 'dog, cat, monkey' ;
$this->view->render('about/about') ;
}
}
或者我应该使用 setter 函数,如:
$this->view->setPageTitle('My Title') ;