Answer the question
In order to leave comments, you need to log in
How to remove unnecessary characters from URL generation?
When generating a URL like this: http://example.com/auth/signup/confirm?token=3DoamqByq61P4fxlTuWoy3j98cjHLh=
Ba_y
Constantly added to the beginning of the 3D and equal somewhere in the middle and has to be manually adjusted to make the code work properly.
How to fix it ?
The URL is generated by this code.
$confirmLink = Yii::$app->urlManager->createAbsoluteUrl(['auth/signup/confirm', 'token' => $user->email_confirm_token]);
?>
<div class="password-reset">
<p>Hello <?= Html::encode($user->username) ?>,</p>
<p>Follow the link below to reset your password:</p>
<p><?= Html::a(Html::encode($confirmLink), $confirmLink) ?></p>
</div>
$confirmLink = Yii::$app->urlManager->createAbsoluteUrl(['auth/signup/confirm', 'token' => $user->email_confirm_token ]);
?>
Hello <?= $user->username ?>,
Follow the link below to reset your password:
<?= $confirmLink ?>
Answer the question
In order to leave comments, you need to log in
It turned out to be the standard encoding of letters.
The problem is solved by opening letters in a regular mail program such as mozila or something bird.
Do a var_dump $confirmLink right after creation.
This is the first thing to do, and then it will be clear whether the problem is higher or lower.
Most likely this occurs after Html::a(Html::encode
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question