Read the session data from session storage file

前端 未结 6 1609
执念已碎
执念已碎 2020-12-01 16:20

Facing problem with PHP unserialize() function as titled it is throwing error.

unserialize() [function.unserialize]: Error at offset 0 of 1781 b         


        
6条回答
  •  伪装坚强ぢ
    2020-12-01 17:01

    If you want to decode session data, use session_decode (see the manual). unserialize only decodes single variables, not session data.

    You can do something like:

    $file = '/var/www/html/products/var/session/sess_ciktos8icvk11grtpkj3u610o3';
    $contents = file_get_contents($file);
    session_start();
    session_decode($contents);
    print_r($_SESSION);
    

提交回复
热议问题