If I use Yii::app()->createUrl('user/login') i will get the result as '/user/login'

But I will use Yii::app()->createUrl('user/login') inside a module i will get '/module/user/login'

Is there any way so that I can '/user/login' irrespective of from where createUrl is called?

I am using a common function which returns the url.

有帮助吗?

解决方案

Yii::app()->createUrl('//user/login')

will work for you. The // refers to the application root. To access controllers inside other modules you can use //module/controller/action

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top