Zf1 - 自动加载器

时间:2014-01-10 13:10:13

标签: php zend-framework

我对加载文件有疑问

我的Application.ini

pluginPaths.Plugins = APPLICATION_PATH "/Plugins"
autoloaderNamespaces[] = "Plugin_"
resources.frontController.plugins[] = "Plugin_Layout"
resources.frontController.plugins[] = "Plugin_Test"

file application / Plugins / Layout.php

内容:

class Plugin_Layout extends Zend_Controller_Plugin_Abstract
{
    public function preDispatch(Zend_Controller_Request_Abstract $request)
    {
      echo 'Plugin_Layout';;
    }
}

file application / Plugins / Test.php

class Plugin_Test extends Zend_Controller_Plugin_Abstract{

    public function postDispatch(Zend_Controller_Request_Abstract $request){

        die('MeaHpl');
    }
}

错误: 警告:include_once():无法打开'Plugin / Test.php'以包含(include_path ='/ home / grek / public_html / biletynaraty / application /../ library:/ home / grek / public_html / biletynaraty / application / .. /library/Vendor/mea:/home/grek/public_html/biletynaraty/library:.:/usr/share/php:/usr/share/pear')/ home / grek / public_html / biletynaraty / library / Zend / Loader第134行的.php

为什么要加载布局 - 测试不是??

如果我从应用程序中移除Plugin_Test,我会在页面上看到:Plugin_Layout所以这个操作被调用

1 个答案:

答案 0 :(得分:0)

删除此行

pluginPaths.Plugins = APPLICATION_PATH "/Plugins"

并将您的插件移到library/Plugin下,您的代码应该可以正常工作。