Home >Backend Development >PHP Tutorial >PHP's session_encode() and session_decode() functions

PHP's session_encode() and session_decode() functions

WBOY
WBOYOriginal
2016-07-25 09:11:331297browse
  1. //boolean session_encode()
  2. session_register ( 'bgcolor' );
  3. session_register ( 'fontcolor' );
  4. $id = session_id ( $usr_id );
  5. $bgcolor = "white";
  6. $fontcolor = "blue";
  7. $usr_data = session_encode ();
  8. print $usr_data;
  9. ?>
复制代码
  1. session_start();
  2. $_SESSION = array();
  3. session_decode( "products|a:2:{i:0;s:8:"Hal 2000";i:1;s:6:"Tardis";}" );
  4. foreach ( $_SESSION['products'] as $p ) {
  5. print "$p
    n";
  6. }
  7. ?>
复制代码


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn