this is session variable
session()->put('user_id',$id);
this is code from login page. I tried to redirect login page if user is already logged in or if session is already created.
<?PHP
session_start();
if(Session::has('YOUR_SESSION_KEY'))
{
return view('list');
}?>
but this is code is not giving any result.How can i redirect to list page if i am logged in.
If ($_SESSION['user_id']) {
header('Location: yourfile.php');
}
header('Location: ...') is redirecting, put path to your file after Location: , Also
If ($_SESSION['user_id'])
same as
If (isset($_SESSION['user_id']))
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.