“模块/应用程序"和“模块/应用程序/src/应用程序"中的 zf2 应用程序文件夹重复 [英] zf2 application folder repetition in 'Modules/Application' and 'Modules/Application/src/Application'
问题描述
为什么在 Modules/和 Modules/Application/src 中有 zf2 Application 文件夹?我的意思是......为什么不是结构模块/应用程序/src/控制器等......?
Why have zf2 Application folder inside Modules/ and Modules/Application/src? I mean... why not the structure Modules/Application/src/controller, etc..?
推荐答案
您可以找到新的 zf2 结构的详细信息 http://akrabat.com/zend-framework-2/modules-in-zf2/
You can find details of the new zf2 structure http://akrabat.com/zend-framework-2/modules-in-zf2/
当我们使用 PHP 5.3 时,我们希望 src 文件夹中的类将被命名空间.默认情况下,假定模块的主名称成为它的主要命名空间,在这种情况下是简单的.为了要做自动加载更简单并遵循 PSR-0 约定,我们创建了src 中的简单命名空间文件夹.这意味着命名空间为类 SimpleController 是文件中的 Simple\Controllersrc/Simple/Controller/SimpleController.php.
As we're using PHP 5.3, we expect that the classes within the src folder will be namespaced. By default, a module's main name is assumed to be its main namespace, Simple in this case. In order to make autoloading simpler and to follow the PSR-0 convention, we create the Simple namespace folder within src. This means that the namespace for the class SimpleController is Simple\Controller within the file src/Simple/Controller/SimpleController.php.
这显然是更简单的模块之一,很可能src/Simple 文件夹将包含其他文件夹,例如 Model、Form 和诸如此类.此外,视图文件夹可能会有更多的子文件夹用于其他控制器.
This is obviously one of the more simple modules and it is likely that the src/Simple folder would have other folders such as Model, Form and such like. Also, the view folder would probably have more sub-folders for other controllers.
这篇关于“模块/应用程序"和“模块/应用程序/src/应用程序"中的 zf2 应用程序文件夹重复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!