0

这些是我对 urlManager 的规则。它仅适用于控制器“vijesti”。当我尝试打开任何其他页面时,它会给我 404 错误。我应该为网址编写自己的课程还是什么?有人可以解释我该怎么做吗?

'<controller:(vijesti)>/<action:(admin|create|update|delete|trazi)>' => 'vijesti/<action>',
'<kategorija:\w+>/<naslov:\w+>'=>'vijesti/view',            
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
4

2 回答 2

1

问题:

该规则'<kategorija:\w+>/<naslov:\w+>'=>'vijesti/view'涵盖'<controller:\w+>/<action:\w+>'=>'<controller>/<action>'

尝试这个:

'<controller:(vijesti)>/<action:(admin|create|update|delete|trazi)>' => 'vijesti/<action>',
'/<kategorija:\w+>/vw_<naslov:\w+>'=>'vijesti/view',            
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
于 2013-11-12T13:39:46.773 回答
0

尝试这个:

'vijesti/<_a:(admin|create|update|delete|trazi|view)>' => 'vijesti/<_a>',
'<kategorija:\w+>/<naslov:\w+>'=>'vijesti/view',            
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
于 2013-11-12T04:44:20.733 回答