Getting Session ID in Laravel
You can use $session_id for Laravel 4.0:
$session_id = session_id();
You can use the below line for Laravel 4.1 and versions above Laravel4.1.
$session_id = Session::getId();
In later versions Laravel doesn’t use built-in PHP sessions directly but the developer can choose a driver to manage the sessions of users. Therefore, you have to use a session façade or session helper to get session ID.
If the above doesn’t work use Session::getId(); in Laravel 4.1.
In Laravel 5.5 version add
use Sessionin the controller then write:
session()->getId();
Comments
0 comments
Please Sign in or Create an account to Post Comments