Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to createabsoluteurl passing two parameters in yii2

I am newbie in Yii2. Please help me to achieve this. I want to know how to create absoluteurl in yii2. I have tried the code given below but I want something different.

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 the url like this

http://car-rental.demoinja.com/site/confirm/?id=69&code=275a9253dfc81efa47be4fdf1fc6a927
like image 971
Sangita Pal Avatar asked Oct 19 '22 02:10

Sangita Pal


1 Answers

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

<?php echo Yii::$app->urlManager->createAbsoluteUrl(['site/confirm', 'id' => $user->id,'code' => $user->token]); ?>
like image 134
GAMITG Avatar answered Nov 01 '22 10:11

GAMITG