简体   繁体   中英

createUrl() issue yii

I try to make header links using createUrl() method. I have subdomain 'account'.

When I use $this->createUrl('account/default/index') it works correct. But I want create link when I locating on http://account.example.com to http://example.com/about .

Can I do that using createUrl() ?

Try in your rules makes route:

 'http://site.com/<controller:\\w+>/<action:\\w+>' => 'site/<controller>/<action>' 

Than for creating url http://site.com/about use Yii::app()->request->createUrl('site/about/index')

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