M
M
Maxemp2018-02-09 08:53:01
Yii
Maxemp, 2018-02-09 08:53:01

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

2 answer(s)
M
Maxemp, 2018-02-10
@Maxemp

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.

I
ivankomolin, 2018-02-09
@ivankomolin

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 question

Ask a Question

731 491 924 answers to any question