How can I store object class into a session in PHP?

后端 未结 4 592
时光取名叫无心
时光取名叫无心 2021-01-19 21:21

How can I have an object class store into PHP session and then get it in my next page as variable. Could you help?

Here is my class.inc.php

class sho         


        
4条回答
  •  醉梦人生
    2021-01-19 21:47

    used this code first page

    $obj = new Object();
    
    $_SESSION['obj'] = serialize($obj);
    

    in second page

    $obj = unserialize($_SESSION['obj']);
    

提交回复
热议问题