zend_application 显示空白页

发布于 2024-08-31 20:27:42 字数 2829 浏览 12 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

恋竹姑娘 2024-09-07 20:27:42

听起来您的代码中的错误导致请求被转发到您的错误控制器。确保在 application.conf 中为您的环境设置以下内容:

phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

还要检查 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:

phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文