2017-04-02 52 views
0

所以我创造我的Laravel App我自己的密码重置系统,当我向用户发送电子邮件恢复链接,如下所示:ヶ辆和进行urlencode在Laravel链接

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

的符号变为“&” 。

我试图做的事情喜欢

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

,但不起作用。

我怎么写这个?

+0

使用'{! url(...)!!}'而不是'{{url(...)}}'不能转义字符。 – devk

+1

其实这可能不会。你总是可以像这样分离'echo'语句:'click this link and reset your password!' – devk

+0

这很有效。如果您需要dem'internet points,请继续并发布答案 –

回答

0

你可以试试这个

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

并在路由文件

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

你可以传递所需的参数作为数组中.blade.php