Will
Will

Reputation: 681

How to check Laravel SessionID?

I am a little confused with the session of Laravel. Laravel will start a session when client request the application and save a _token in the session if none of _token has been set.

But when using isset($_SESSION) to check the session, it returns false. why cannot check laravel session by isset($_SESSION)?

How can I get the Laravel SessionID?

Upvotes: 0

Views: 2294

Answers (2)

Rupert
Rupert

Reputation: 1639

It is different depending on your Laravel version.

//Version 3:
$id = $_COOKIE["laravel_session"];

//Version 4:
$id = session_id();

//Laravel 4.1 and up:
$id = Session::getId();

Upvotes: 2

Antonio Carlos Ribeiro
Antonio Carlos Ribeiro

Reputation: 87719

This is how you get Laravel sesssion id:

echo Session::getId();

Upvotes: 2

Related Questions