简体   繁体   中英

Laravel Save value in session or Cookie

I need to save a value before redirect and re-use it after redirect back to my website, the flow is:

  • Set value in session

    session(['name' => 'value']); session()->save(); return redirect($checkout_session->url);

  • Controller return an URL

  • Client will be redirected to this

  • Go back on my website and than I'll check all session values, but it is empty.

     public function checkSession( { dd(session()->all()); }

I dont understand why

要在会话中保存值,请尝试:

session()->put('key', 'value');

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