php发起会话并创建一些session变量

<?php

   // Initiate session and create a few session variables
   session_start();
   /* http://www.manongjc.com/article/1271.html */
   // Set the variables. These could be set via an HTML form, for example.
   $_SESSION[\'username\'] = \"joe\";
   $_SESSION[\'loggedon\'] = date(\"M d Y H:i:s\");

   // Encode all session data into a single string and return the result
   $sessionVars = session_encode();
   echo $sessionVars;

?>
收藏 打印