zend_application 显示空白页
我正在使用 Zend_Application 来引导我的应用程序。
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{ 公共静态$frontController = null; 公共静态$registry = null;
protected function _initEnvironment()
{
ini_set('display_errors', true);
//date_default_timezone_set('Europe/London');
}
protected function _initRegistry()
{
self::$registry = new Zend_Registry(array(), ArrayObject::ARRAY_AS_PROPS);
Zend_Registry::setInstance(self::$registry);
}
protected function _initConfiguration()
{
$config = new Zend_Config_Ini(
BASE_PATH . '/data/server/settings.ini',
APPLICATION_ENV
);
self::$registry->configuration = $config;
}
protected function _initLogging() {
$config = self::$registry->configuration;
$logger = new Zend_Log(new Zend_Log_Writer_Stream($config->logging->file));
Zend_Registry::set('logger', $logger);
}
protected function _initFrontController()
{
self::$frontController = Zend_Controller_Front::getInstance();
self::$frontController->throwExceptions(true);
self::$frontController->returnResponse(true);
self::$frontController->setControllerDirectory(
APPLICATION_PATH .'/controllers'
);
self::$frontController->setParam('registry', self::$registry);
return self::$frontController;
}
protected function _initView()
{
$config = self::$registry->configuration;
$view = new Zend_View;
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
Zend_Layout::startMvc(
array(
'layoutPath' => APPLICATION_PATH . "/layouts/scripts",
'layout' => "layout"
)
);
return $view;
}
protected function _initDatabase()
{
$config = self::$registry->configuration;
$params = array('host' => $config->database->hostname,
'username' => $config->database->username,
'password' => $config->database->password,
'dbname' => $config->database->database);
$db = Zend_Db::factory($config->database->type, $params);
Zend_Registry::set('db', $db);
}
protected function _initPlaceholders() {
$view = $this->getResource('View');
$view->doctype('XHTML1_STRICT');
$view->headTitle('Greplin')
->setSeparator(' / ');
$view->headLink()->prependStylesheet('/src/css/header.css');
$view->headScript()->prependFile('/js/site.js');
return $view;
}
当
我运行该应用程序时,我得到一个空白页面。 文件名/路径完好无损。
如果我将die()
添加到layout.phtml 的底部,我就会得到该页面。
正在重置标题并发送空白页面。 我的错误报告已打开,但出现了不相关的错误。
这可能是什么?
谢谢!
I'm using Zend_Application to bootstrap my app.
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
public static $frontController = null;
public static $registry = null;
protected function _initEnvironment()
{
ini_set('display_errors', true);
//date_default_timezone_set('Europe/London');
}
protected function _initRegistry()
{
self::$registry = new Zend_Registry(array(), ArrayObject::ARRAY_AS_PROPS);
Zend_Registry::setInstance(self::$registry);
}
protected function _initConfiguration()
{
$config = new Zend_Config_Ini(
BASE_PATH . '/data/server/settings.ini',
APPLICATION_ENV
);
self::$registry->configuration = $config;
}
protected function _initLogging() {
$config = self::$registry->configuration;
$logger = new Zend_Log(new Zend_Log_Writer_Stream($config->logging->file));
Zend_Registry::set('logger', $logger);
}
protected function _initFrontController()
{
self::$frontController = Zend_Controller_Front::getInstance();
self::$frontController->throwExceptions(true);
self::$frontController->returnResponse(true);
self::$frontController->setControllerDirectory(
APPLICATION_PATH .'/controllers'
);
self::$frontController->setParam('registry', self::$registry);
return self::$frontController;
}
protected function _initView()
{
$config = self::$registry->configuration;
$view = new Zend_View;
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
Zend_Layout::startMvc(
array(
'layoutPath' => APPLICATION_PATH . "/layouts/scripts",
'layout' => "layout"
)
);
return $view;
}
protected function _initDatabase()
{
$config = self::$registry->configuration;
$params = array('host' => $config->database->hostname,
'username' => $config->database->username,
'password' => $config->database->password,
'dbname' => $config->database->database);
$db = Zend_Db::factory($config->database->type, $params);
Zend_Registry::set('db', $db);
}
protected function _initPlaceholders() {
$view = $this->getResource('View');
$view->doctype('XHTML1_STRICT');
$view->headTitle('Greplin')
->setSeparator(' / ');
$view->headLink()->prependStylesheet('/src/css/header.css');
$view->headScript()->prependFile('/js/site.js');
return $view;
}
}
When I run the app I get a blank page.
Filenames / paths are intact.
If I add die()
to the bottom of my layout.phtml, I get the page.
Something is resetting the headers and sending a blank page.
My error reporting is on and I get unrelated errors.
What could this be?!
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来您的代码中的错误导致请求被转发到您的错误控制器。确保在 application.conf 中为您的环境设置以下内容:
还要检查 ErrorController.php 以确保出现错误时输出某些内容。
当然,您也应该始终检查服务器日志。
It sounds like an error in your code is causing requests to be forwarded to your error controller. Make sure the following is set for your environment in application.conf:
Also check ErrorController.php to make sure something outputs when there's an error.
Of course, you should always check your server logs as well.