문제

I have the following rule, in my config/main.php:

'<controller:\w+>/<action:\w+>/<param:\w+>'=>'<controller>/<action>',

Can I have in ExperienceController an action actionListByDistrict($param) that is called when the URL /mysite/experience/district/value is used?

I would like to do a kind of mapping in Yii Framework, but how? Actually the action takes this form: actionDistrict($param).

도움이 되었습니까?

해결책

The rule that I mention on the comment should work:

'experience/district/<param:\w+>'=>'experience/listByDistrict'

Make sure this specific rule stays on top, because the order on Yii UrlManager Rules matters.

About the general rule however, I don't see way for doing it atm.

:)

다른 팁

You can try that 'experience/district/<id:\d+>'=>'experience/listByDistrict/',

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top