相思资源网 Design By www.200059.com
php4比php3新加了session的支持。稍微用了一下,对其函数接口,内部机制,
应用的方便性做了大概的了解。
session的意义大家都应该清楚,一个session可以包括数次http的请求和应答,
比如我们用163.net,从login到logout或者超时就作为一个session,session
的唯一标识一般是在系统内部生成一个唯一的session ID,一般是一个挺长的
字符串。一个session除了session ID,还可以有自己的session data,可以
记录和区分sesion的不同状态。
php4对session操作提供以下接口:
session_start — Initialize session data
session_destroy — Destroys all data registered to a session
session_name — Get and/or set the current session name
session_module_name — Get and/or set the current session module
session_save_path — Get and/or set the current session save path
session_id — Get and/or set the current session id
session_register — Register a variable with the current session
session_unregister — Unregister a variable from the current session
session_is_registered — Find out if a variable is registered in a session
session_decode — Decodes session data from a string
session_encode — Encodes the current session data as a string
意义大家一看就能明白,session_start开始一个session,session_destroy结
束一个session,session_id取得当前的session_id,session_register向当前
的session注册一个变量,这个很有用,比如用户逛商场,选中了某几样商品你
就可以用session_register把商品名称或者代码register到当前的session中。
比如下面例子(摘自php manual):
<?php
session_register("count");
$count++;
?>
Hello visitor, you have seen this page <? echo $count; ?> times.<p>
# the <?=SID?> is necessary to preserve the session id
# in the case that the user has disabled cookies
To continue, <A HREF="nextpage.php?<?=SID?>">click here</A>
session_register可以隐式地激发session_start(如果用户之前没发session_
start调用),当前的session注册了一个变量count,每次用户点击click here
的时候,这个变量都会增一。你可以自己试一下。<?=SID?>的意义不多赘述。
应用的方便性做了大概的了解。
session的意义大家都应该清楚,一个session可以包括数次http的请求和应答,
比如我们用163.net,从login到logout或者超时就作为一个session,session
的唯一标识一般是在系统内部生成一个唯一的session ID,一般是一个挺长的
字符串。一个session除了session ID,还可以有自己的session data,可以
记录和区分sesion的不同状态。
php4对session操作提供以下接口:
session_start — Initialize session data
session_destroy — Destroys all data registered to a session
session_name — Get and/or set the current session name
session_module_name — Get and/or set the current session module
session_save_path — Get and/or set the current session save path
session_id — Get and/or set the current session id
session_register — Register a variable with the current session
session_unregister — Unregister a variable from the current session
session_is_registered — Find out if a variable is registered in a session
session_decode — Decodes session data from a string
session_encode — Encodes the current session data as a string
意义大家一看就能明白,session_start开始一个session,session_destroy结
束一个session,session_id取得当前的session_id,session_register向当前
的session注册一个变量,这个很有用,比如用户逛商场,选中了某几样商品你
就可以用session_register把商品名称或者代码register到当前的session中。
比如下面例子(摘自php manual):
<?php
session_register("count");
$count++;
?>
Hello visitor, you have seen this page <? echo $count; ?> times.<p>
# the <?=SID?> is necessary to preserve the session id
# in the case that the user has disabled cookies
To continue, <A HREF="nextpage.php?<?=SID?>">click here</A>
session_register可以隐式地激发session_start(如果用户之前没发session_
start调用),当前的session注册了一个变量count,每次用户点击click here
的时候,这个变量都会增一。你可以自己试一下。<?=SID?>的意义不多赘述。
相思资源网 Design By www.200059.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
相思资源网 Design By www.200059.com
暂无php4的session功能评述(一)的评论...
《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线
暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。
艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。
《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。