YII2 Forbidden (#403) You are not allowed to access this page

找下config/main.php,把本机ip地址加进去就好了

'gii' => [ 'class' => 'yii\gii\Module','allowedIPs' => ['127.0.0.1','::1','192.168.0.*','192.168.178.20']//在这里添加上你的电脑的IP即可]

添加之后访问 index.php?r=gii就可以访问到GII工具的页面了