use*_*179 6 php url-routing yii
我想在Yii中使用Gii.我的第一个webapp的protected/config/main.php已将此部分取消注释,按照Yii文档中的说明启用Gii(123.45.67.123是我尝试访问的计算机上的公共IP地址):
'modules'=>array(
// uncomment the following to enable the Gii tool
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>'123456',
// If removed, Gii defaults to localhost only. Edit carefully to taste.
'ipFilters'=>array('123.45.67.123','127.0.0.1','::1'),
),
),
Run Code Online (Sandbox Code Playgroud)
我还通过取消注释以下内容在我的protected/config/main.php中启用了urlManager:
// uncomment the following to enable URLs in path-format
'urlManager'=>array(
'urlFormat'=>'path',
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
Run Code Online (Sandbox Code Playgroud)
当我访问我的Yii网站时,例如www.example.org,基本的Yii页面加载正常.当我做www.example.org/gii时,我得到了404.当我去www.example.org/index.php?r=gii时,我得到了404.为什么我的Gii页面找不到?我使用的是CentOS 5.6.
k t*_*e z 17
尝试:
http://www.example.org/index.php/gii
看来你和url的规则相同.如果http://www.example.org带您进入主yii webapp页面,则上述链接应该可以正常工作.
您要访问http://www.example.org/gii,这是不正确的.