Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/28.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
使用Yii的URL管理_Yii_Yii Url Manager - Fatal编程技术网

使用Yii的URL管理

使用Yii的URL管理,yii,yii-url-manager,Yii,Yii Url Manager,我有url:/profile/profileBase/index,其中“profile”是模块,“profileBase”是控制器,“index”是动作。 我想知道url管理器会接受如下路由:/profile/read/index 其中“read”可以是控制器的别名。 使用url管理器规则有什么方法可以做到这一点吗? 谢谢您只需在urlManagerconfig中添加以下规则即可: 'profile/read/index'=>'profile/profileBase/index',

我有url:/profile/profileBase/index,其中“profile”是模块,“profileBase”是控制器,“index”是动作。 我想知道url管理器会接受如下路由:/profile/read/index 其中“read”可以是控制器的别名。 使用url管理器规则有什么方法可以做到这一点吗?
谢谢

您只需在
urlManager
config中添加以下规则即可:

'profile/read/index'=>'profile/profileBase/index',
   'urlManager' => array(
        'urlFormat' => 'path',
        'showScriptName' => false,
        'rules' => array(
          'profile/read/index '=>'profile/profileBase/index'
        ),
    ),