这是使用MVC模板的最佳方式


Which is the best way to use a template with MVC

拥有这样的模板更好吗

<html>
<head>
<title><?php echo $this->data['title']; ?></title>
</head>
<body>
   <?php echo $this->data['content']; ?>
</body>
</html>

或者有一个类似的东西:

require('head.php');
require('header.php');
require('content.php');
require('footer.php');

这只是一个偏好问题。我个人喜欢将页眉、正文和页脚分开。在我自己的小世界里似乎更干净。我还使用了一个模板文件来将它们解析在一起,既然你提到了mvc,我猜你已经编好了。