简体   繁体   English

是否可以在不包含“ application.php”(加载太多多余资源)的情况下使用Zend模块化结构?

[英]Is it possible to use Zend modular structure without including “application.php” (which loads too many excess resourses)?

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.php”的问题,同时我希望有可能在Zend Framework中使用模块化结构。 APPLICATION loads too many unnecessary and excess things (if Zend Framework is being used not by 100%). 应用程序加载了太多不必要和多余的东西(如果没有100%使用Zend Framework)。 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. 与高负载的项目一起工作时,我发现禁用Zend Autoloader并包含自己制作的文件“ ZendLight_small.php”(在其中放置了Zend Framework所需的所有所有缺少的类/函数)是一件好事,以增加可能的成功数量电话。 (with Zend Autoloader - 40 calls per second (by JMeter), with ZendLight_small.php - 60 cps.) (使用Zend Autoloader-每秒40次调用(由JMeter进行,使用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. 我只是不需要使用太多的Zend函数,但是包含文件的总数(使用Zend Application)是一团糟。 Thanks beforehand. 预先感谢。

I have been using Zend components for close to 6 months now, but have never used Zend_Application. 我已经使用Zend组件近6个月了,但是从未使用过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. Zend_类是应用程序,而不是应用程序的一部分。 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. 然后,我初始化Zend_Autoload,从那时起就可以访问我在Zend中的感觉。 Last initialisation step but not least, I have a settings file that is just a plain array returned and loaded in Zend_Config. 最后一个初始化步骤,但并非最不重要的一点是,我有一个设置文件,它只是一个返回并加载到Zend_Config中的普通数组。

These 3-4 lines of very lightweight code have made my life so much better, you would not believe. 您不会相信,这3-4行非常轻巧的代码使我的生活变得更加美好。 I mostly rely on Zend_logger, Zend_DB and its friends Zend_Table, Zend_TableRowset etc .. and Zend_Mail. 我主要依靠Zend_logger,Zend_DB及其朋友Zend_Table,Zend_TableRowset等..和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. 尽管我只使用了框架的很小一部分 ,但它极大地减少了我的开发时间,而且重要的是:结果很容易维护。

You can use the "old" (pre-1.8) bootstrap method. 您可以使用“旧的”(1.8之前的版本)引导程序方法。 No need for Zend_Application. 不需要Zend_Application。 We use that with ZF 1.11 with no problems. 我们将其与ZF 1.11毫无问题地结合使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM