Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/246.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Yii-1.1.12框架,使用另一个控制器_Php_Yii - Fatal编程技术网

Php Yii-1.1.12框架,使用另一个控制器

Php Yii-1.1.12框架,使用另一个控制器,php,yii,Php,Yii,我尝试用yii框架制作网站,并制作友好的URL。在里面 如果我使用友好的URL,如: http://localhost/eshops/ -> calls protected/controllers/SiteController->actionIndex() http://localhost/eshops/login -> calls protected/controllers/SiteController->actionLogin() http://localho

我尝试用yii框架制作网站,并制作友好的URL。在里面 如果我使用友好的URL,如:

http://localhost/eshops/     -> calls protected/controllers/SiteController->actionIndex()
http://localhost/eshops/login -> calls protected/controllers/SiteController->actionLogin()
http://localhost/eshops/logout -> calls protected/controllers/SiteController->actionLogout()
 ...
但是如何使用另一个控制器像

http://localhost/eshops/abc/a -> calls protected/controllers/AbcController->actionA()
http://localhost/eshops/abc/b -> calls protected/controllers/AbcController->actionB()
它没有显示“错误404”

.htaccess是

Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
规则位于protected/config/main.php中

'urlManager'=>array(
    'urlFormat'=>'path',
    'showScriptName'=>false,
    'caseSensitive'=>false,
    'rules'=>array(
        'gii'=>'gii',
        '<action>'=>'site/<action>',
        '<controller:\w+>/<id:\d+>'=>'<controller>/view',
        '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
        '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
    ),
),
'urlManager'=>数组(
“urlFormat'=>“路径”,
'showScriptName'=>false,
“区分大小写”=>错误,
'规则'=>数组(
“gii”=>“gii”,
''=>'站点/',
“/”=>“/视图”,
'//'=>'/',
'/'=>'/',
),
),

谢谢

您需要记住执行规则的顺序!你只需要设定正确的规则顺序

'rules'=>array(
        'gii'=>'gii',
        '<controller:\w+>/<id:\d+>'=>'<controller>/view',
        '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
        '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
        '<action:(login|logout|register|contact)>' => 'site/<action>',
//      or full access 
//      '<action:\w+>' => 'site/<action>',
    ),
“规则”=>数组(
“gii”=>“gii”,
“/”=>“/视图”,
'//'=>'/',
'/'=>'/',
''=>'站点/',
//或完全访问
//''=>'站点/',
),

我们需要查看您的.htaccess和您的urlManager规则,并显示您的urlManager规则您的基本URL是什么?或者,当您删除规则时,第二组URL是否有效?