Home > PHP Framework > YII > body text

How to use yii modules

(*-*)浩
Release: 2019-12-30 13:54:33
Original
1580 people have browsed it

How to use yii modules

yii2 Model creation can be created through the gii tool, which is convenient and fast (recommended learning: yii tutorial)

yii2 can be created in the root directory of the project A modules folder stores each module. Of course, you can also create another module in each module

Create a module directly in the project root directory

See screenshot--》 Then click Preview--》generate to generate the payment module

How to use yii modulesDon’t forget an operation at this time!!!!!!!!!!!!!!!

The above prompts to add the model namespace to the configuration file: For the basic version, open web.php and add the following mapping relationship to the $config array
backend\modules\admin\Module

ModuleID: admin

'modules' => [
        'payment' => [
            'class' => 'app\modules\payment\Payment',
        ],
 ],
Copy after login

Then you can access the corresponding route in the browser, which can be the following:

r=payment                      默认找到payment/default/index
r=payment/default            gii默认创建了default控制器和index操作
r=payment/default/index     这个可以访问,上面说过了
Copy after login

The above is the detailed content of How to use yii modules. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
yii
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!