试图获得非对象Zend Bootstrap的属性

时间:2010-08-30 08:07:10

标签: zend-framework

我正在将网站从开发转移到生产,突然间这个错误不断出现:

Notice: Trying to get property of non-object in /var/www/vhosts/xxxx/httpdocs/application/Bootstrap.php on line 16
Notice: Trying to get property of non-object in /var/www/vhosts/xxxx/httpdocs/application/Bootstrap.php on line 17
Notice: Trying to get property of non-object in /var/www/vhosts/xxxx/httpdocs/application/Bootstrap.php on line 18

此时的代码写道:

$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
    $config = Zend_Registry::get('config');
    $param = array( "template_dir"  => $config->smarty->template_dir,
                    "compile_dir"   => $config->smarty->compile_dir,
                    "config_dir"    => $config->smarty->config_dir,
                    "cache_dir"     => $config->smarty->cache_dir
                    );

    $view = new Zend_View_Smarty(null, $param);

所以$ config似乎是一个非对象,让var_dump:

object(Zend_Config_Ini)#43 (11) { ... }

对我来说似乎是一个对象,可能认为配置文件无法读取。但我可以fopen,fread它,值列在var_dump。

我的常规网站与此网站之间的唯一区别;它在子域上运行。我无法弄清楚与Zend_Config_Ini有什么关系,特别是当可以读取配置文件时。

1 个答案:

答案 0 :(得分:2)

还有一段时间......我发现ini文件中的一行没有用引号正确关闭:

site.basedir        = "/

应该是:

site.basedir        = "/"

那些星期一早上: - )