array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.session-encode.php', 1 => 'session_encode', ), 'up' => array ( 0 => 'ref.session.php', 1 => 'Session 函数', ), 'prev' => array ( 0 => 'function.session-destroy.php', 1 => 'session_destroy', ), 'next' => array ( 0 => 'function.session-gc.php', 1 => 'session_gc', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'zh', 'path' => 'reference/session/functions/session-encode.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4, PHP 5, PHP 7, PHP 8)
session_encode — 将当前会话数据编码为字符串
session_encode() 返回一个序列化后的字符串,包含被编码的、储存于 $_SESSION 超全局变量中的当前会话数据。
默认情况下,PHP 内部使用的序列方法和 serialize() 是不一样的。 该序列方法通过 session.serialize_handler 来设置。
此函数没有参数。
返回当前会话编码后的内容, 或者在失败时返回 false
。
在调用 session_encode() 之前必须先调用 session_start()。