serialize variables of the php session to json format

advertisements

I want to access PHP session variables through jQuery. What is the best way to do so?


<?php
echo json_encode($_SESSION);
?>

Be careful what you store in the session though. ;)