Php 直接改变变量还是使用setter函数?

Php 直接改变变量还是使用setter函数?,php,oop,model-view-controller,setter,Php,Oop,Model View Controller,Setter,在页面控制器内设置页面标题标签等变量时,哪一种是最佳做法 我有: class About extends Controller { public function Index() { $this->view->pageTitle = 'test 123' ; $this->view->metaDescription = 'Description here' ; $this->view->metaKeywords = 'dog, cat

在页面控制器内设置页面标题标签等变量时,哪一种是最佳做法

我有:

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') ;
都不是。视图应该从模型层请求它需要的数据,并根据获取的数据决定应该使用哪些模板来生成响应


你现在拥有的是一个哑巴。因为没有真正的视图,所以您没有实现MVC。

我没有真正听到您的要求,因为我正忙于查看您的个人资料图片。。