简体   繁体   中英

Urlmanager and Controller::createUrl bug in YII

I have next rules for urlmanager rules in my config.main :

'<view:(history|our_contacts)>'=>'site/page',

Then, in code I use:

<?=  CController::createAbsoluteUrl('/site/page', array('view'=>'our_contacts'))  //generate site.ru/our_contacts ?>

and

<?=  CController::createAbsoluteUrl('/site/page', array('view'=>'test'))  //generate site.ru/test ?>

Then, generated: site.ru/our_contacts - work site.ru/test - not work

How I set rules for my config, where Controller::createUrl generate next links:

site.ru/our_contacts
site.ru/site/page?view=test

Your url is:

'<view:(history|our_contacts)>'=>'site/page',

You code params: array('view'=>'test') not validate.

Сan take use only param: (history|our_contacts)

正确的规则:

'<view:(agreement|vendors|partners|help|about|howtobuy)>'=> array('site/page' , 'matchValue'=>true),

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM