简体   繁体   中英

HTMLEntities and URLencode in Laravel link

So I'm creating my own password reset system on my Laravel app, and when I email the user the recovery link, shown here:

<a href='{{ url("forgotpassword/reset?email={$user->email}&recovery={$recoveryString}") }}'>click this link and reset your password!</a>

the ampersand becomes "&".

I tried doing things likes

{{ url("forgotpassword/reset?email={$user->email} }}<?php echo urlencode('&'); ?>{{ recovery={$recoveryString}") }}'>click this link and reset your password!</a> }}

but that doesn't work.

How could I write this?

You can Try this

<a href='{{ route("forgetpassword",array( "email@email.com","recoveryString")) }}'>click this link and reset your password!</a>

and in your route file

Route::get('user/forgetpassword/{email}/{recoveryString}', [
'as' => 'forgetpassword', 'uses' => 'UserController@forgetPassword'
]);

you can pass required parameter as array in .blade.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM