Can You Switch PHP Sessions In a Session?

前端 未结 7 1771
情深已故
情深已故 2020-12-09 19:31

I have two apps that I\'m trying to unify. One was written by me and another is a CMS I am using. My authentication happens in the one I coded and I\'d like my CMS to know t

7条回答
  •  悲哀的现实
    2020-12-09 20:12

    session_regenerate _id()

    The manual explains this pretty well but here's some example from the manual

    session_start();
    
    $old_sessionid = session_id();
    
    session_regenerate_id();
    
    $new_sessionid = session_id();
    
    echo "Old Session: $old_sessionid
    "; echo "New Session: $new_sessionid
    "; print_r($_SESSION);

提交回复
热议问题