<legend id='cONnQ'><style id='cONnQ'><dir id='cONnQ'><q id='cONnQ'></q></dir></style></legend>

    • <bdo id='cONnQ'></bdo><ul id='cONnQ'></ul>
  • <tfoot id='cONnQ'></tfoot>

    1. <small id='cONnQ'></small><noframes id='cONnQ'>

      <i id='cONnQ'><tr id='cONnQ'><dt id='cONnQ'><q id='cONnQ'><span id='cONnQ'><b id='cONnQ'><form id='cONnQ'><ins id='cONnQ'></ins><ul id='cONnQ'></ul><sub id='cONnQ'></sub></form><legend id='cONnQ'></legend><bdo id='cONnQ'><pre id='cONnQ'><center id='cONnQ'></center></pre></bdo></b><th id='cONnQ'></th></span></q></dt></tr></i><div id='cONnQ'><tfoot id='cONnQ'></tfoot><dl id='cONnQ'><fieldset id='cONnQ'></fieldset></dl></div>

        如何在 YII2 中创建模块

        How to create modules in YII2(如何在 YII2 中创建模块)
        <i id='lZEEu'><tr id='lZEEu'><dt id='lZEEu'><q id='lZEEu'><span id='lZEEu'><b id='lZEEu'><form id='lZEEu'><ins id='lZEEu'></ins><ul id='lZEEu'></ul><sub id='lZEEu'></sub></form><legend id='lZEEu'></legend><bdo id='lZEEu'><pre id='lZEEu'><center id='lZEEu'></center></pre></bdo></b><th id='lZEEu'></th></span></q></dt></tr></i><div id='lZEEu'><tfoot id='lZEEu'></tfoot><dl id='lZEEu'><fieldset id='lZEEu'></fieldset></dl></div>

        <small id='lZEEu'></small><noframes id='lZEEu'>

        <legend id='lZEEu'><style id='lZEEu'><dir id='lZEEu'><q id='lZEEu'></q></dir></style></legend>

        <tfoot id='lZEEu'></tfoot>
          <bdo id='lZEEu'></bdo><ul id='lZEEu'></ul>

                <tbody id='lZEEu'></tbody>
                • 本文介绍了如何在 YII2 中创建模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  如何在 yii2 中创建模块并在配置上设置相同的模块.我在谷歌上搜索了一段时间,但找不到那么多教程.请帮忙.

                  How to create a module in yii2 and setting up the same on configuration. I've been searching a while on google and I cannot find that much tutorial on it. Please help.

                  推荐答案

                  选项 1

                  1. 在您的应用程序基本路径上创建一个模块文件夹.这将与您当前运行的应用程序的 @app 别名相对应.这与高级模板中的基本模板或后端/前端的根文件夹相同.

                  1. Create a modules folder on your application base path. This would be what corresponds to your @app alias of your currently running application. This is the same as the root folder of basic template or backend/frontend in the advanced template.

                  在您的模块文件夹中,为您的模块创建一个与模块 ID 相对应的文件夹.

                  Inside your modules folder create a folder for your module corresponding to the Module ID.

                  你的模块类应该在这个模块文件夹中并且应该扩展yiiaseModule.这是您的模块类的基本工作示例.

                  Your Module Class should be inside this module folder and should extend yiiaseModule. This is a basic working example for your module class.

                  <?php
                  
                  namespace appmoduleshome;
                  
                  class Home extends yiiaseModule
                  {
                     public $controllerNamespace = 'appmoduleshomecontrollers';
                  
                     public function init()
                     {
                         parent::init();
                  
                         // custom initialization code goes here
                     }
                  }
                  

                • 在同一文件夹中创建模块控制器、模型和视图文件夹.

                • Create your module controller, models and views folder on the same folder.

                  要访问该模块,您需要将其添加到您的应用程序配置中:

                  To access the module, you need to add this to your application configuration:

                  <?php
                  ......
                     'modules' => [
                        'home' => [
                           'class' => 'appmoduleshomeHome',
                        ],
                     ],
                  ......
                  

                • 选项 2

                  1. 如果您使用 Gii 模块,请转到模块生成器并输入模块类的路径.这将与选项中的 appmoduleshomeHome 相同1

                  预览并生成所有文件.根据您的模块类更改应用程序配置,如选项 1 中所述.

                  Preview and Generate all files. Change application configuration as in Option 1 according to your module class.

                  这篇关于如何在 YII2 中创建模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Is Joomla 2.5 much faster than Joomla 1.5 Querywise(Joomla 2.5 比 Joomla 1.5 Querywise 快得多吗)
                  How to share Joomla login session from one joomla website to one ASP.Net MVC website(如何将 Joomla 登录会话从一个 joomla 网站共享到一个 ASP.Net MVC 网站)
                  htaccess redirect root to subdirectory but allow index.php in root AND query strings to function(htaccess 将根重定向到子目录,但允许根和查询字符串中的 index.php 起作用)
                  Joomla include database functions(Joomla 包含数据库功能)
                  nl2br() not working when displaying SQL results(显示 SQL 结果时 nl2br() 不起作用)
                  Joomla 2.5 JFactory::getSession(); seems to be caching in firefox(Joomla 2.5 JFactory::getSession();似乎在 Firefox 中缓存)

                    • <legend id='vI2we'><style id='vI2we'><dir id='vI2we'><q id='vI2we'></q></dir></style></legend>
                      • <bdo id='vI2we'></bdo><ul id='vI2we'></ul>
                        <tfoot id='vI2we'></tfoot>
                          <tbody id='vI2we'></tbody>

                        <small id='vI2we'></small><noframes id='vI2we'>

                            <i id='vI2we'><tr id='vI2we'><dt id='vI2we'><q id='vI2we'><span id='vI2we'><b id='vI2we'><form id='vI2we'><ins id='vI2we'></ins><ul id='vI2we'></ul><sub id='vI2we'></sub></form><legend id='vI2we'></legend><bdo id='vI2we'><pre id='vI2we'><center id='vI2we'></center></pre></bdo></b><th id='vI2we'></th></span></q></dt></tr></i><div id='vI2we'><tfoot id='vI2we'></tfoot><dl id='vI2we'><fieldset id='vI2we'></fieldset></dl></div>