Heim  >  Artikel  >  Backend-Entwicklung  >  PHP会话处理相关函数介绍【上】

PHP会话处理相关函数介绍【上】

WBOY
WBOYOriginal
2016-07-25 08:51:13784Durchsuche
PHP处理会话函数1 session_start
函数功能:开始一个会话或者返回已经存在的会话。
函数原型:boolean session_start(void);
返回值:布尔值
功能说明:这个函数没有参数,且返回值均为true。最好将这个函数置于最先,而且在它之前不能有任何输出,否则会报警,如:Warning: Cannot send session cache limiter headers already sent (output started at/usr/local/apache/htdocs/cga/member/1.php:2) in/usr/local/apache/htdocs/cga/member/1.php on line 3
PHP处理会话函数2 session_register
函数功能:登记一个新的变量为会话变量
函数原型:boolean session_register(string name);
返回值:布尔值。
功能说明:这个函数是在全局变量中增加一个变量到当前的SESSION中,参数name就是想要加入的变量名,成功则返回逻辑值true。可以用$_SESSION[name]$HTTP_SESSION_VARS[name]的形式来取值或赋值。
PHP处理会话函数3 session_is_registered
函数功能:检查变量是否被登记为会话变量。
函数原型:boobean session_is_registered(string name);
返回值:布尔值
功能说明:这个函数可检查当前的session之中是否已有指定的变量注册,参数name就是要检查的变量名。成功则返回逻辑值true
PHP处理会话函数4 session_unregister
函数功能:删除已注册的变量。
函数原型:boolean session_session_unregister(stringname);
返回值:布尔值
功能说明:这个函数在当前的session之中删除全局变量中的变量。参数name就是欲删除的变量名,成功则返回true
PHP处理会话函数5session_destroy
函数功能:结束当前的会话,并清空会话中的所有资源。
函数原型:boolean session destroy(void);
返回值:布尔值。
功能说明:这个函数结束当前的session,此函数没有参数,且返回值均为true

免费领取LAMP兄弟连原创php教程光盘/《细说PHP》精要版,详情咨询官网客服:http://www.lampbrother.net
PHPCMS二次开发 http://yun.itxdl.cn/online/phpcms/index.php?u=5
微信开发            http://yun.itxdl.cn/online/weixin/index.php?u=5
移动互联网服务器端开发   http://yun.itxdl.cn/online/server/index.php?u=5
Javascript课程   http://yun.itxdl.cn/online/js/index.php?u=5
CTO训练营                  http://yun.itxdl.cn/online/cto/index.php?u=5



Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn