Php session serial variables in json format

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

+3
source share
2 answers
<?php
echo json_encode($_SESSION);
?>

Be careful what you keep in the session.;)

+5
source

https://github.com/zhangjiayin/php_session_json_handler/

PHP EXTENSION FOR SESSION WITH JSON SAERIALIZE FORMAT

config php.ini

session.serialize_handler = json

can help you try?

0
source

All Articles