【问题标题】:Zend Framework baseURL error after deploying from os x to linux server从 os x 部署到 linux 服务器后 Zend Framework baseURL 错误
【发布时间】:2013-06-18 20:38:54
【问题描述】:

我有一个可以在我的本地 OS X 机器上正常运行的 Zend Framework 应用程序。 Zend 文件夹也包含在我的项目中,位于library/。当我在我的 Linux 服务器上设置我的代码时,我现在收到了这个错误:

Fatal error: Uncaught exception 'Zend_Loader_PluginLoader_Exception' 
with message 'Plugin   by name 'BaseURL' was not found in the registry; used paths: 
Zend_View_Helper_: Zend/View/Helper/:/var/www/best_dashboard/application/views/helpers/'
in /var/www/best_dashboard/library/Zend/Loader/PluginLoader.php:412 Stack trace: #0 
/var/www/best_dashboard/library/Zend/View/Abstract.php(1182): Zend_Loader_PluginLoader-
>load('BaseURL') #1 /var/www/best_dashboard/library/Zend/View/Abstract.php(618): Zend_View_Abstract->_getPlugin('helper', 'baseURL') #2 
/var/www/best_dashboard/library/Zend/View/Abstract.php(344): Zend_View_Abstract-
>getHelper('baseURL') #3 [internal function]: Zend_View_Abstract->__call('baseURL', Array)
 #4 /var/www/best_dashboard/application/layouts/scripts/layout.phtml(11): Zend_View-
>baseURL() #5 /var/www/best_dashboard/library/Zend/View.php(108): 
include('/var/www/best_d...') #6 
/var/www/best_dashboard/library/Zend/View/Abstract.php(888): Zend_View-
>_run('/var/www/best_d...') #7 /var/www/best_dashboard/library/Zen in 
/var/www/best_dashboard/library/Zend/Controller/Plugin/Broker.php on line 336

我看到的其他一些人出现此错误是因为他们正在从 Windows 转到 Linux,而 BaseURL 的情况不同并且刹车。我不认为这是我的问题,因为我要从 OS X 转到 Linux。

是什么导致了这个错误?

更新:

我正在使用 Zend Framework 1.12.3

我在 Linux 服务器上使用 apache,在本地 OS X 机器上使用 MAMP。

【问题讨论】:

  • 如何调用 baseUrl() 视图助手?
  • headLink()->prependStylesheet($this->baseURL().'/libs/bootstrap/css/bootstrap.css'); ?>'

标签: php zend-framework


【解决方案1】:

我认为调用视图助手的正确方法是

$this->baseUrl()  

(检查大小写,Linux对此有点挑剔)

【讨论】:

  • 我在 Linux 上对其进行了更改,现在可以使用了。我还在我的 OS X 机器上更改了它,它仍然可以工作。只是困惑为什么 baseURL 可以在 OS X 上工作,是不是和 Linux 一样挑剔?
  • 老实说,我不了解 OS X。我的 Windows 环境中的某些文件名也有类似的问题。由于 Windows 对文件系统不区分大小写,包括 MyFile.php 或 myFile.php 是相同的,但对于 Linux,MyFile.php 和 myFile.php 是两个不同的文件。当您在 ZF 中的视图中调用函数时,它将尝试包含与函数同名但大写字母的文件。这意味着,当您调用 $this->baseUrl() 时,它会查找 BaseUrl.php,但当您调用 $this->baseURL() 时,它会查找 BaseURL.php。希望这很清楚;)
猜你喜欢
  • 2011-11-14
  • 1970-01-01
  • 1970-01-01
  • 2016-04-18
  • 1970-01-01
  • 2012-08-03
  • 2020-08-15
  • 2012-04-21
  • 2021-10-23
相关资源
最近更新 更多