Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP, print_r($_SESSION) doesn't show its content?

Tags:

php

session

I want to see the content of the the array $_SESSION with the command print_r($_SESSION) but what I get is just the following output:

Array ()

what am I missing ?

thanks

like image 823
aneuryzm Avatar asked Nov 29 '22 11:11

aneuryzm


1 Answers

Make sure you call session_start() at the top of all the pages you wish to use the session.

http://php.net/manual/en/function.session-start.php

<?php

session_start();

echo "<pre>";
print_r($_SESSION);
echo "</pre>";

?>
like image 115
Lizard Avatar answered Dec 05 '22 00:12

Lizard