![](/img/trans.png)
[英]PHP Zend Authentication - How can I tell Zend the user is authenticated
[英]How can i continue the user to the requested page after authenticated?
我想知道在使用laravel 5.2
進行身份驗證后如何繼續用戶請求的頁面? 我需要設置一個會話,還是laravel可以執行此操作?
示例:我尚未注冊。 我正在尋找產品。 我單擊"Order Now"
按鈕。 然后,我進入login/register
頁面。 獲得身份驗證后,我將轉到要訂購的產品的訂購頁面。
對不起,我的新手問題。 我可以就如何正確執行此過程獲得一些幫助。 也許我對此有一些參考。 謝謝。
您可以在Laravel中使用預期的URL方法。
例如:
public function authenticate()
{
if(Auth::attempt(['email'=> $email, 'password'=>$password])
{
return redirect()->intended('dashboard');
}
}
在上面的示例中,如果沒有預期的URL,則用戶將在登錄后重定向到“儀表板”。 否則,他將在登錄后重定向到最后一頁。
預期的url是將用戶重定向到登錄頁面。
在此處閱讀更多信息: https : //laravel.com/docs/5.2/authentication#authenticating-users
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.