Home >PHP Framework >YII >What does gii in yii mean?
In Yii, gii is an extension that automatically generates code through gii and leaves some common codes to the program to generate, which greatly reduces the developer's time cost.
The Gii extension is undoubtedly a great help for the rapid development of yii2. By using gii to generate code, the development time and cost are greatly saved.
But gii also has some disadvantages, that is, the generated code is the template that comes with yii2. The code generated every time is not what we want, so we have to make corresponding adjustments every time.
So how to use the gii extension component?
To use gii in yii, you need to enable the gii extension in the configuration file first. Find the main.php file in the config directory under the current project. You will see that as shown in the figure below, gii is blocked. Comment, if you need to enable it, you need to remove the comment
You need to enter a password before you can operate it. The password is just under main.php gii Where to set the extension
It should be noted that it is not safe to open the gii extension and may be exploited by hackers. It is recommended to turn off the gii extension after the project is completed
Now log in to gii
Let’s create a module first, as shown below
First click Preview, then click Generate
Then we go to the project directory Take a look below
#You can see that the current module is the one we just created, then let’s use this module, open the controller, and then we create a method (test method)
If the above two pictures appear, it proves that gii is opened successfully.
Recommended related article tutorials: "yii Framework Tutorial", "PHP Tutorial"
The above is the detailed content of What does gii in yii mean?. For more information, please follow other related articles on the PHP Chinese website!