Zend Framework:无法回显doctype或stylesheet路径;回显对象id#

时间:2012-02-21 17:25:02

标签: zend-framework

我已经将我的Quickstart项目从Windows机器FTP到Linux机箱,我从这些陈述中得到了意想不到的结果:

echo $this->doctype();
echo $this->headLink()->appendStylesheet('/css/main.css');

我的输出应该如下所示(Windows机器):

<!DOCTYPE html>
<html lang="en">
<head>
    <link href="/css/main.css" media="screen" rel="stylesheet" type="text/css" >
    <title>Sample Zend app</title>
</head>
<body>
    <h1>This is my layout</h1>
    <p>This is index.phtml</p>
</body>
</html>

这是我在Linux机箱上的输出:

Object id #37
<html lang="en">
<head>
    Object id #49
    <title>Sample Zend app</title>
</head>
<body>
    <h1>This is my layout</h1>
    <p>This is index.phtml</p>
</body>
</html>

我知道为什么我的语句回应我的样式表的doctype和路径,产生 Object id #xx

提前致谢。

另外 - 我提供了Boostrap,application.ini和layout:

bootstrap.php中:     

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {

    protected function _initDocType() {
        $this->bootstrap('view');
        $view = $this->getResource('view');
        $view->doctype('HTML5');
    }
}

的application.ini:

[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
resources.view[] = 
[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1

layout.phtml:

<?php echo $this->doctype(); ?>
<html lang="en">
<head>
    <?php echo $this->headLink()->appendStylesheet('/css/main.css'); ?>
    <title>Sample Zend app</title>
</head>
<body>
    <h1>This is my layout/h1>
    <?php echo $this->layout()->content; ?>
</body>
</html>

1 个答案:

答案 0 :(得分:0)

php文档说__toString()在5.2之前的工作方式不同。我会升级你的php或直接调用函数,例如

$something->__toString();

请参阅:http://www.php.net/manual/en/language.oop5.magic.php#object.tostring