Php 无法在Zend Framework中获取doctype的输出
在我的引导程序中,我有这个代码Php 无法在Zend Framework中获取doctype的输出,php,zend-framework,Php,Zend Framework,在我的引导程序中,我有这个代码 $view = new Zend_View(); $view->setEncoding('UTF-8'); $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view); Zend_Controller_Action_HelperBroker::addHelper($viewRenderer); $viewRenderer->initV
$view = new Zend_View();
$view->setEncoding('UTF-8');
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
$viewRenderer->initView();
$viewRenderer->view->doctype('XHTML1_TRANSITIONAL');
Zend_Layout::startMvc(
array(
'layoutPath' => dirname(__FILE__) . '/layouts/scripts/'
)
);
在我的layout.phtml中
<?php echo $this->doctype(); ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php $this->headTitle()->append('Site Title'); ?>
<?php echo $this->headTitle(); ?>
</head>
<body>
<div class="dp100">
<?php
echo $this->layout()->content;
?>
</div>
</body>
</html>
不过,我在最后的HTML页面中没有看到预期的doctype声明。Duh!我在Firebug中检查我的源代码,它实际上隐藏了DOCTYPE声明,因为它没有首先在HTML文档中得到响应。在回显doctype之前,我回显了jquery include语句 通过检查Firefox中的实际源代码找到了解决方案