Php 使用Yii-urlManager的非标准URL

Php 使用Yii-urlManager的非标准URL,php,regex,url,yii,pcre,Php,Regex,Url,Yii,Pcre,我需要使用像这样的URL,例如:api.wwhost.com/index.php?r=people.top 所以,我试着写一个模式 'urlManager'=>array( 'urlFormat'=>'path', 'showScriptName'=>false, 'caseSensitive'=>false, 'useStrictParsing'=>true, 'rules'=>array( '<

我需要使用像
这样的URL,例如:api.wwhost.com/index.php?r=people.top

所以,我试着写一个模式

'urlManager'=>array(
    'urlFormat'=>'path',
    'showScriptName'=>false,
    'caseSensitive'=>false,
    'useStrictParsing'=>true,
    'rules'=>array(
        '<controller:\w+>.<action:\w+>' => '<controller>/<action>',
    ),
),
'urlManager'=>数组(
“urlFormat'=>“路径”,
'showScriptName'=>false,
“区分大小写”=>错误,
“useStrictParsing”=>true,
'规则'=>数组(
'.' => '/',
),
),
但它不起作用。据我所知,符号“.”不包括在“\w+”中

我的错误在哪里?

对于我来说,当处于“路径”模式(
'urlFormat'=>'path'
)时,我不能使用
index.php?r=people/top
样式的URL。当我处于
路径
模式时,我的
?r=
样式的URL都不起作用。你也经历过同样的事情吗

当我处于“获取”模式(
'urlFormat'=>'get'
)时,它们会这样做,但在获取模式下,URL规则不会被处理,并且默认情况下仅使用“/”作为分隔符

当我使用此样式的URL时,您的代码确实适用于我:

api.wwwhost.com/people.top
设置“路径”模式时(即
'urlFormat'=>'path'
),请确保正确设置
.htaccess
文件以使用它(隐藏index.php文件)。更多信息请点击这里