PHP - session编码和解码

 

<?php 
    
    //session编码
    session_start();
    
    $_SESSION['name'] = 'Jack';
    $_SESSION['sex'] = 'men';
    
    $envar = session_encode();
    
    echo $envar;//name|s:4:"Jack";sex|s:3:"men";
    
    
    
    
    echo '<br/>';
    
    
    
    
    
    //session解码
    session_decode($envar);
    
    echo $_SESSION['name']."-".$_SESSION['sex'];

?>

 

posted on 2015-11-25 20:22  ultrastrong  阅读(1187)  评论(0编辑  收藏  举报