开发者

Yii urlManager route with query string

This is about setting WebRoot/protected/config/main.php *urlManager* on Yii Framework.

I want a few predefined url like /About /Contact or some other custom special page like /LatestUpdates or /HTCDesire

I can do 'Contact'=>'site/contact' to map /Contact to /site/contact

How can I 'hard code' query string to the route?

I try:

'About'=>'site/page?view=about'
'LatestUpdates'=>'update/view?id=65'
'HTCDesire'=>'product/view?id=33'

but not working, 404 not found because it expect the right side should be route in format controller/action.

I try:

'LatestUpdates'=>'update/view/id/开发者_如何转开发65'

I can browse to /LatestUpdates but the anchor link still shows /update/view/id/65

Is there any other way?


This works for me (except I substituted your values in, so maybe I broke it...):

'LatestUpdates'=>array('update/view','defaultParams'=>array('id'=>'65')),

More about this here and here.

Cheers!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜