Zend 模块结构的全局助手

发布于 2024-12-17 04:49:38 字数 355 浏览 4 评论 0原文

我的文件如下所示:

/Zend
  /Application
    /Configs
    /Modules
       /home
          /controllers
          /views
       /login
          /controllerS              
          /forms
          /library
             /login
          /models
          /plugins
          /views

我想创建一个可供所有模块使用的助手。有点像“全球帮手”。有没有标准的方法来实现这一点?

My files look like this:

/Zend
  /Application
    /Configs
    /Modules
       /home
          /controllers
          /views
       /login
          /controllerS              
          /forms
          /library
             /login
          /models
          /plugins
          /views

I would like to create a helper which which can be used by all modules. Kinda a "global helper". Is there a standard way to accomplish this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

探春 2024-12-24 04:49:38

什么样的帮手?看法?或者像行动助手之类的东西?如果它只是一个实用程序样式类(未附加到 MVC 的特定部分),只需将其放入 /library/NAMESPACE 即可。

然后只需将该命名空间添加到 application.ini 中的自动加载器即可。

autoloadernamespaces[] = NAMESPACE

然后你就可以

$helper = new NAMESPACE_Helper();

What kind of helper? View? Or something like a action helper? If it's just a utility style class (not attached to a specific part of the MVC), just putting it in /library/NAMESPACE works well.

Then just add that namespace to the autoloader in application.ini.

autoloadernamespaces[] = NAMESPACE

And you can then

$helper = new NAMESPACE_Helper();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文