How to create absoluteurl by passing two parameters in yii2

I am new to Yii2. Please help me achieve this. I want to know how to create absoluteurl in yii2. I tried the code below, but I need something else.

echo Yii::$app->urlManager->createAbsoluteUrl(['site/confirm', 'id' => $user->id,'code' => $user->token,'&']); output is http://car-rental.demoinja.com/site/confirm/69?code=275a9253dfc81efa47be4fdf1fc6a927&1=%26 

But I want this url

 http://car-rental.demoinja.com/site/confirm/?id=69&code=275a9253dfc81efa47be4fdf1fc6a927 
+5
source share
1 answer

No need to add '&' to createAbsoluteUrl ; so you need to use the following function.

 <?php echo Yii::$app->urlManager->createAbsoluteUrl(['site/confirm', 'id' => $user->id,'code' => $user->token]); ?> 
+3
source

All Articles