search
Homephp教程php手册php4的session功能评述(一)
php4的session功能评述(一)Jun 13, 2016 pm 12:40 PM
sessiononeFunctionsupportCompareof

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):  

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?>的意义不多赘述。  

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
如何在技嘉主板上设置键盘启动功能 (技嘉主板启用键盘开机方式)如何在技嘉主板上设置键盘启动功能 (技嘉主板启用键盘开机方式)Dec 31, 2023 pm 05:15 PM

技嘉的主板怎么设置键盘开机首先,要支持键盘开机,一定是PS2键盘!!设置步骤如下:第一步:开机按Del或者F2进入bios,到bios的Advanced(高级)模式普通主板默认进入主板的EZ(简易)模式,需要按F7切换到高级模式,ROG系列主板默认进入bios的高级模式(我们用简体中文来示范)第二步:选择到——【高级】——【高级电源管理(APM)】第三步:找到选项【由PS2键盘唤醒】第四步:这个选项默认是Disabled(关闭)的,下拉之后可以看到三种不同的设置选择,分别是按【空格键】开机、按组

CS玩家的首选:推荐的电脑配置CS玩家的首选:推荐的电脑配置Jan 02, 2024 pm 04:26 PM

1.处理器在选择电脑配置时,处理器是至关重要的组件之一。对于玩CS这样的游戏来说,处理器的性能直接影响游戏的流畅度和反应速度。推荐选择IntelCorei5或i7系列的处理器,因为它们具有强大的多核处理能力和高频率,可以轻松应对CS的高要求。2.显卡显卡是游戏性能的重要因素之一。对于射击游戏如CS而言,显卡的性能直接影响游戏画面的清晰度和流畅度。建议选择NVIDIAGeForceGTX系列或AMDRadeonRX系列的显卡,它们具备出色的图形处理能力和高帧率输出,能够提供更好的游戏体验3.内存电

SpringBoot Session怎么设置会话超时SpringBoot Session怎么设置会话超时May 15, 2023 pm 02:37 PM

问题发现springboot项目生产session-out超时问题,描述下问题:在测试环境通过改动application.yaml配置session-out,经过设置不同时间验证session-out配置生效,于是就直接设置了过期时间为8小时发布到了生产环境。然而中午接到客户反应项目过期时间设置较短,半小时不操作就会话过期需要反复登陆。解决处理开发环境:springboot项目内置Tomcat,所以项目中application.yaml配置session-out是生效的。生产环境:生产环境发布是

php session刷新后没有了怎么办php session刷新后没有了怎么办Jan 18, 2023 pm 01:39 PM

php session刷新后没有了的解决办法:1、通过“session_start();”开启session;2、把所有的公共配置写在一个php文件内;3、变量名不能和数组下标相同;4、在phpinfo里面查看session数据的存储路径,并查看该文件目录下的sessio是否保存成功即可。

session php默认失效时间是多少session php默认失效时间是多少Nov 01, 2022 am 09:14 AM

session php默认失效时间是1440秒,也就是24分钟,表示客户端超过24分钟没有刷新,当前session就会失效;如果用户关闭了浏览器,会话就会结束,Session就不存在了。

广联达软件电脑配置推荐;广联达软件对电脑的配置要求广联达软件电脑配置推荐;广联达软件对电脑的配置要求Jan 01, 2024 pm 12:52 PM

广联达软件是一家专注于建筑信息化领域的软件公司,其产品被广泛应用于建筑设计、施工、运营等各个环节。由于广联达软件功能复杂、数据量大,对电脑的配置要求较高。本文将从多个方面详细阐述广联达软件的电脑配置推荐,以帮助读者选择适合的电脑配置处理器广联达软件在进行建筑设计、模拟等操作时,需要进行大量的数据计算和处理,因此对处理器的要求较高。推荐选择多核心、高主频的处理器,如英特尔i7系列或AMDRyzen系列。这些处理器具有较强的计算能力和多线程处理能力,能够更好地满足广联达软件的需求。内存内存是影响计算

主板上的数字音频输出接口-SPDIF OUT主板上的数字音频输出接口-SPDIF OUTJan 14, 2024 pm 04:42 PM

主板上SPDIFOUT连接线序最近我遇到了一个问题,就是关于电线的接线顺序。我上网查了一下,有些资料说1、2、4对应的是out、+5V、接地;而另一些资料则说1、2、4对应的是out、接地、+5V。最好的办法是查看你的主板说明书,如果找不到说明书,你可以使用万用表进行测量。首先找到接地,然后就可以确定其他的接线顺序了。主板vdg怎么接线连接主板的VDG接线时,您需要将VGA连接线的一端插入显示器的VGA接口,另一端插入电脑的显卡VGA接口。请注意,不要将其插入主板的VGA接口。完成连接后,您可以

Redis的共享session应用如何实现短信登录Redis的共享session应用如何实现短信登录Jun 03, 2023 pm 03:11 PM

1.基于session实现短信登录1.1短信登录流程图1.2实现发送短信验证码前端请求说明:说明请求方式POST请求路径/user/code请求参数phone(电话号码)返回值无后端接口实现:@Slf4j@ServicepublicclassUserServiceImplextendsServiceImplimplementsIUserService{@OverridepublicResultsendCode(Stringphone,HttpSessionsession){//1.校验手机号if

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment