<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 中创建模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                    • <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>