我正在尝试在我的项目中添加 View 帮助程序,但出现以下错误:
[Mon Apr 29 14:36:19 2013] [error] [client 10.0.0.26] PHP Fatal error: Uncaught exception 'Zend_Loader_PluginLoader_Exception' with message 'Plugin by name 'LoggedInAs' was not found in the registry; used paths:\nMy_View_Helper_: /var/www/html/test-project/application/views/helpers/\nZend_View_Helper_: Zend/View/Helper/:/var/www/html/test-project/application/views/helpers/' in /usr/share/php/Zend/Loader/PluginLoader.php:412\nStack trace:\n#0 /usr/share/php/Zend/View/Abstract.php(1182): Zend_Loader_PluginLoader->load('LoggedInAs')\n#1 /usr/share/php/Zend/View/Abstract.php(618): Zend_View_Abstract->_getPlugin('helper', 'loggedInAs')\n#2 /usr/share/php/Zend/View/Abstract.php(344): Zend_View_Abstract->getHelper('loggedInAs')\n#3 /var/www/html/test-project/application/layouts/scripts/layout.phtml(16): Zend_View_Abstract->__call('loggedInAs', Array)\n#4 /var/www/html/test-project/application/layouts/scripts/layout.phtml(16): Zend_View->loggedInAs()\n#5 /usr/share/php/Zend/View.php(108): include('/var/www/html/t...')\n#6 /usr/share/php/Zend/View/Abstract.php(888): Zend_View->_run('/var/www/html/ in / /usr/share/php/Zend/Controller/Plugin/Broker.php on line 336
应用程序/views/helpers/LoggedInAs.php
class My_View_Helper_LoggedInAs extends Zend_View_Helper_Abstract
{
public function loggedInAs()
{
//code
}
}
应用程序/配置/application.ini
resources.view[]=
resources.view.helperPath.My_View_Helper = APPLICATION_PATH "/views/helpers"
应用程序/布局/脚本/layout.phtml
echo $this->loggedInAs();
stackoverflow 上还有其他几个问题,但这些对我不起作用。
编辑 1:
更改Zend_View_Helper_LoggedInAs
为My_View_Helper_LoggedInAs
Tim Fountain 的回答后
编辑 2:
完全错误