Laravel链接中的HTMLEntities和URLencode

时间:2017-04-02 20:46:48

标签: php laravel

所以我在我的Laravel应用程序上创建了自己的密码重设系统,当我通过电子邮件向用户发送恢复链接时,如下所示:

<a href='{{ url("forgotpassword/reset?email={$user->email}&recovery={$recoveryString}") }}'>click this link and reset your password!</a>
&符号变为“&amp;”。

我尝试过像

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

但这不起作用。

我怎么写这个?

1 个答案:

答案 0 :(得分:0)

你可以试试这个

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

并在您的路线文件中

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

您可以将所需参数作为数组传递到.blade.php