简体   繁体   English

我试图在YII中使用GII功能,但是当我打开gii页面时它给了我错误

[英]I am trying to use GII feature in YII, but it gives me error when I am opening the gii page

It gives me error. 它给了我错误。

Error 403 You are not allowed to access this page. 错误403您无权访问此页面。

I have uncommented this code in the main.php file inside protected directory. 我在protected目录下的main.php文件中取消注释了这段代码。

'gii'=>array(
        'class'=>'system.gii.GiiModule',
        'password'=>'admin',
        // If removed, Gii defaults to localhost only. Edit carefully to taste.
        'ipFilters'=>array('127.0.0.1','::1'),
    ),

Please help. 请帮忙。

Here is the solution to your problem: 以下是您的问题的解决方案:

http://www.yiiframework.com/wiki/115/why-do-i-get-a-403-error-when-trying-to-use-gii/ http://www.yiiframework.com/wiki/115/why-do-i-get-a-403-error-when-trying-to-use-gii/

You need to add your ip address to the 'ipFilters' array 您需要将您的IP地址添加到'ipFilters'数组

'ipFilters' => array('127.0.0.1', 'your_ip_address')

Are you accessing gii using localhost ? 你使用localhost访问gii吗? Are you able to access your local webserver using localhost ? 您是否可以使用localhost访问本地Web服务器? You cannot access your webserver by using localhost if you haven't mapped 127.0.0.1 to localhost which most of the times done by-default for you depending upon your system and the way you installed php / apache 如果您没有将127.0.0.1映射到localhost ,则无法使用localhost访问您的Web服务器,大多数情况下默认为您完成,具体取决于您的系统和安装php / apache

'ipFilters'=>array('127.0.0.1','*.*.*.*')

and then close it or change it back afterwards... 然后将其关闭或更改回来......

because if you don't... kiddies will take you down 因为如果你不这样做......小子会把你带走

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM