是否可以使用 Zend 模块化结构而不包含“application.php”? (这会加载太多多余的资源)?
我正在寻找如何摆脱包含“application.php”的解决方案,同时我希望有可能在 Zend Framework 中使用模块化结构。 APPLICATION 加载了太多不必要和多余的东西(如果 Zend Framework 没有被 100% 使用)。 在处理高负载项目时,我发现最好禁用 Zend Autoloader 并包含自己制作的文件“ZendLight_small.php”(其中我放置了 Zend Framework 所需的所有缺失的类/函数),以增加可能成功的数量来电。 (使用 Zend Autoloader - 每秒 40 次调用(通过 JMeter),使用 ZendLight_small.php - 60 cps。)
...
我也想摆脱下一件事(我也不需要引导结构):
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
->run();
...
那么,这有可能吗?我只是不需要使用这么多的 Zend 函数,但是包含的文件(带有 Zend 应用程序)的总数是一团糟。 预先感谢。
I'm looking for solution how to get rid of including "application.php" and at the same time i want to have possibility to use modular structure in Zend Framework.
APPLICATION loads too many unnecessary and excess things (if Zend Framework is being used not by 100%).
Working with high-loaded project i found that it's good to disable Zend Autoloader and include own-made file "ZendLight_small.php" (where i put all all missing classes/functions which are being required by Zend Framework) for increasing quantity of possible successful calls. (with Zend Autoloader - 40 calls per second (by JMeter), with ZendLight_small.php - 60 cps.)
...
I also wanna get rid of next thing (i dont need bootstrap structure also):
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
->run();
...
So, is it somehow possible? I just don't need to use so much Zend functions, but total sum of included files (with Zend Application) is a mess.
Thanks beforehand.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我使用 Zend 组件已经接近 6 个月了,但从未使用过 Zend_Application。
我想主要原因是我主要开发控制台脚本,并使用组件作为助手。 Zend_ 类是应用程序的一部分,而不是应用程序的一部分。我从定义脚本常量的最小引导文件开始。然后我初始化 Zend_Autoload,从那时起就可以访问我在 Zend 中想要的任何内容。最后的初始化步骤但并非最不重要的是,我有一个设置文件,它只是返回并加载到 Zend_Config 中的普通数组。
这 3-4 行非常轻量的代码让我的生活变得如此美好,你可能不会相信。我主要依赖 Zend_logger、Zend_DB 及其朋友 Zend_Table、Zend_TableRowset 等以及 Zend_Mail。 仅在需要时加载。
虽然我只使用框架的非常小的子集,但它大大减少了我的开发时间,并且最重要的是:结果更容易维护。
I have been using Zend components for close to 6 months now, but have never used Zend_Application.
I guess the main reason is I mostly develop console scripts, and use the components as helpers. Zend_ classes are part of the applications, not the application. I start with a minimal bootstrap file that defines the script constants. Then I initialize Zend_Autoload and from then on have access to whatever I feel like in Zend. Last initialisation step but not least, I have a settings file that is just a plain array returned and loaded in Zend_Config.
These 3-4 lines of very lightweight code have made my life so much better, you would not believe. I mostly rely on Zend_logger, Zend_DB and its friends Zend_Table, Zend_TableRowset etc .. and Zend_Mail. Loaded only if needed.
Although I only use a very small subset of the framework, it has greatly cut down my developpment time and most important: the result is way easier to maintain.
您可以使用“旧”(1.8 之前)引导方法。不需要 Zend_Application。我们将其与 ZF 1.11 一起使用,没有任何问题。
You can use the "old" (pre-1.8) bootstrap method. No need for Zend_Application. We use that with ZF 1.11 with no problems.