The reason why this error occurs in the first place is that you are not allowed to access the page, which is also a security consideration of the yii2 framework.
We need to configure the gii tool in config/web.php:
'gii' => [ 'class' => 'yii\gii\Module','allowedIPs' => ['127.0.0.1','::1','192.168.0.*','192.168.178.20'] //在这里添加上你的电脑的IP即可]
After adding it, visit basic/web/index.php?r=gii to access the GII tool page
PHP Chinese website has a large number of free Yii introductory tutorials, everyone is welcome to learn!
The above is the detailed content of What should I do if a 403 error occurs on the yii2 website?. For more information, please follow other related articles on the PHP Chinese website!