我正在关注本教程(Zend Framework 1.11 入门):http ://akrabat.com/wp-content/uploads/Getting-Started-with-Zend-Framework.pdf
在第 10 页,zf-tutorial/application/layouts/scripts/layout.phtml,代码更改为:
<?php echo $this->layout()->content; ?>
至:
<?php
$this->headMeta()->appendHttpEquiv('Content-Type', 'text/html;charset=utf-8');
$this->headTitle()->setSeparator(' - ');
$this->headTitle('Zend Framework Tutorial');
echo $this->doctype(); ?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<?php echo $this->headMeta(); ?>
<?php echo $this->headTitle(); ?>
</head>
<body>
<div id="content">
<h1><?php echo $this->escape($this->title); ?></h1>
<?php echo $this->layout()->content; ?>
</div>
</body>
问题:
输出是一样的,为什么要改代码?
在我运行原始代码后:
<?php echo $this->layout()->content; ?>
,在页面源代码中:有这样的输出:<!DOCTYPE HTML PUBLIC....
在我运行修改后的代码后,在页面源代码中,<!DOCTYPE HTML PUBLIC....
应该出现两次,一个来自$this->headMeta()...
,一个来自<?php echo $this->layout()->content; ?>
,但它只出现一次,为什么?