[英]Undefined variable: $_SESSION Laravel
I have problem when get PHP superglobal variable $_SESSION
from inside laravel controller. 我从laravel控制器内部获取PHP超全局变量$_SESSION
时遇到问题。
I can get Moodle session from laravel. 我可以从laravel参加Moodle会议。 I can get moodle session in laravel with $_SESSION['USER']
using this example , but if I run php artisan route:list
it returns an error, like this: 使用此示例 ,我可以使用$_SESSION['USER']
在laravel中进行穆德勒会话,但是如果我运行php artisan route:list
,则会返回错误,如下所示:
So I cannot use the Laravel redirect function. 所以我不能使用Laravel重定向功能。 Can anyone help me with this? 谁能帮我这个? Is there any other way to call the superglobal $_SESSION
in the Laravel controller? 还有其他方法可以在Laravel控制器中调用超全局$_SESSION
吗? Thank you 谢谢
You can use session functions provided by laravel 您可以使用laravel提供的会话功能
Save something on session variable 在会话变量上保存一些内容
Session::put('name', 'yourname');
Retrieve 取回
Session::get('name')
Unset 未设定
Session::forget('name');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.