easyrecoveryprofessionalphp4的session功能评述(一)
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了easyrecoveryprofessionalphp4的session功能评述(一),小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2000字,纯文字阅读大概需要3分钟。
内容图文
![easyrecoveryprofessionalphp4的session功能评述(一)](/upload/InfoBanner/zyjiaocheng/161/0701e1a72b0b42958c92d9e55d155208.jpg)
应用的方便性做了大概的了解。
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):
session_register("count");
$count++;
?>
Hello visitor, you have seen this page echo $count; ?> times.
# the =SID?> is necessary to preserve the session id
# in the case that the user has disabled cookies
To continue, ">click here
session_register可以隐式地激发session_start(如果用户之前没发session_
start调用),当前的session注册了一个变量count,每次用户点击click here
的时候,这个变量都会增一。你可以自己试一下。=SID?>的意义不多赘述。
以上就介绍了easyrecovery professional php4的session功能评述(一),包括了easyrecovery professional方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
内容总结
以上是互联网集市为您收集整理的easyrecoveryprofessionalphp4的session功能评述(一)全部内容,希望文章能够帮你解决easyrecoveryprofessionalphp4的session功能评述(一)所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。