Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top