下面这几个实例主要是讲了关于php session在实际应用的操作,如果有session创建 注销 初始化 注册实例,PHP实例代码如下:
-
- */
- session_start();
- $_session["name"]="mike";
- $_session["sex"]="male";
- print_r($_session);
- echo "<br>";
- echo "----------------------------";
- echo "<br>";
- session_unset();
- print_r($_session);
- session_destroy();
-
-
- $barney="a big purple dinosaur.";
- session_register("barney");
- $_session["zim"]="an invader from another planet.";
- $http_session_vars["spongebob"]="he's got square pants.";
-
-
- session_start();
- $_session['name']="yoursession";
- $result=session_module_name();
- echo $result."n";
- session_destroy();
-
-
- session_start();
- $old_sessionid=session_id();
- session_regenerate_id();
- $new_sessionid=session_id();
- echo "old session:$old_sessionid<br/>";
- echo "new session:$new_sessionid<br/>";
- print_r($_session);
|