位置: 编程技术 - 正文

PHP:session_register()的用法_Session函数

编辑:rootadmin
session_register

推荐整理分享PHP:session_register()的用法_Session函数,希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:,内容如对您有帮助,希望把文章链接给更多的朋友!

(PHP 4, PHP 5 < 5.4.0)

session_register — Register one or more global variables with the current session

说明 bool session_register ( mixed $name [, mixed $... ] )

session_register() accepts a variable number of arguments, any of which can be either a string holding the name of a variable or an array consisting of variable names or other arrays. For each name, session_register() registers the global variable with that name in the current session.

You can also create a session variable by simply setting the appropriate member of the $_SESSION or $HTTP_SESSION_VARS (PHP < 4.1.0) array.<?php//Useofsession_register()isdeprecated$barney="Abigpurpledinosaur.";session_register("barney");//Useof$_SESSIONispreferred,asofPHP4.1.0$_SESSION["zim"]="Aninvaderfromanotherplanet.";//Theoldwaywastouse$HTTP_SESSION_VARS$HTTP_SESSION_VARS["spongebob"]="He'sgotsquarepants.";?>

If session_start() was not called before this function is called, an implicit call to session_start() with no parameters will be made. $_SESSION does not mimic this behavior and requires session_start() before use.

Warning

本函数已自 PHP 5.3.0 起废弃并将自PHP 5.4.0 起移除。

参数

name

A string holding the name of a variable or an array consisting of variable names or other arrays.

...

返回值 PHP:session_register()的用法_Session函数

成功时返回 TRUE, 或者在失败时返回 FALSE。

注释 Caution

If you want your script to work regardless of register_globals, you need to instead use the $_SESSION array as $_SESSION entries are automatically registered. If your script uses session_register(), it will not work in environments where the PHP directive register_globals is disabled.

Note: register_globals 重要说明:

自 PHP 4.2.0 起,PHP 指令 register_globals 的默认值为 off。PHP 社区鼓励开发者不要依赖于此指令, 用其他手段替代,例如superglobals。

Caution

This registers a global variable. If you want to register a session variable from within a function, you need to make sure to make it global using the global keyword or the $GLOBALS[] array, or use the special session arrays as noted below.

Caution

If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use session_register(), session_is_registered(), and session_unregister().

Note:

It is currently impossible to register resource variables in a session. For example, you cannot create a connection to a database and store the connection id as a session variable and expect the connection to still be valid the next time the session is restored. PHP functions that return a resource are identified by having a return type of resource in their function definition. A list of functions that return resources are available in the resource types appendix.

If $_SESSION (or $HTTP_SESSION_VARS for PHP 4.0.6 or less) is used, assign values to $_SESSION. For example: $_SESSION[&#;var&#;] = &#;ABC&#;;

参见

session_is_registered() - 检查变量是否在会话中已经注册 session_unregister() - Unregister a global variable from the current session $_SESSION

PHP:session_regenerate_id()的用法_Session函数 session_regenerate_id(PHP4=4.3.2,PHP5)session_regenerate_id使用新生成的会话ID更新现有会话ID说明boolsession_regenerate_id([bool$delete_old_session=false])session_regenerate_id()在不

PHP:session_register_shutdown()的用法_Session函数 session_register_shutdown(PHP=5.4.0)session_register_shutdown关闭会话说明voidsession_register_shutdown(void)将session_write_close()函数注册为关闭会话的函数。参数此函数没有

PHP:session_name()的用法_Session函数 session_name(PHP4,PHP5)session_name读取/设置会话名称说明stringsession_name([string$name])session_name()函数返回当前会话名称。如果指定name参数,session_name()函数会更新

标签: PHP:session_register()的用法_Session函数

本文链接地址:https://www.jiuchutong.com/biancheng/279902.html 转载请保留说明!

上一篇:PHP:session_save_path()的用法_Session函数

下一篇:PHP:session_regenerate_id()的用法_Session函数

  • 幼儿园会计需要做什么工作
  • 增值税为10%的有哪些
  • 怎么计算土地增值税的相关税金
  • 准予扣除的税金及附加怎么算
  • 二手车经纪公司和中介的区别
  • 子公司之间股权转让
  • 转租仓库交增值税吗
  • 发票上的收款人负法律责任吗
  • 简易计税的进项可以抵扣吗
  • 未达起征点可以开专票吗
  • 税务局多扣的一笔钱
  • 怎么强调各个分公司之间无直接联系
  • 预缴企业所得税怎么做会计分录
  • 接受捐赠材料需要交税吗
  • 季度奖需要交税吗
  • 分公司亏损是否也分摊所得税
  • 当月销项税大于进项税怎么办
  • 简易计税算税收优惠吗
  • 应付汇差是什么意思
  • 个人在电商平台购买跨境商品需要缴纳什么税
  • 代扣代缴个人所得税现金流计入哪里
  • 高速公路通行费发票怎么开
  • 税收分类编码选错了没事吧
  • 华为股权激励制度
  • 应收账款周转率高好还是低好
  • 境外个人所得税计算
  • 应付账款周转天数上升的原因
  • 营改增后城建税怎么算
  • 分配股利在报表中怎么填
  • 报销车费怎么贴
  • 实收资本印花税按次还是按年
  • 哪些发票可以开专票
  • win10 删除文件 没有找到项目
  • 笔记本windows10截屏
  • 王者荣耀干将莫邪技能
  • 微软 windows11
  • 男人喜欢什么样的女人最容易动心
  • 电力安装公司需要什么资质证书
  • javascript编写程序
  • 抵扣认证发票统计确认后可以退回吗?
  • js实现继承属性功能
  • 过来人告诉你:女人最珍贵的三种东西,舍得给你说明爱你
  • 小规模餐饮业如何征税
  • 现金流量表哪些数据和资产负债表一致
  • 股东以房产投资公司
  • dedecms调用页面
  • 购买牵引车和挂车购车流程
  • PostgreSQL教程(十):性能提升技巧
  • 车辆罚款单可作为费用报销吗
  • 宾馆里面的牙膏收费吗
  • 自产自销免税农产品需要缴纳印花税吗
  • 宣传费抵扣
  • 出口退税的计算与流程
  • 实收资本主要包括哪些
  • 农业机耕开发票税收分类编码是什么?
  • 哪些发票必须注销
  • 新公司建立 需要先做哪行
  • win10系统浏览器在哪
  • 直接内存访问控制器是什么
  • win2008远程桌面闪退
  • linux系统常用命令怎么记住
  • kvm虚拟机是什么
  • auepuc.exe是什么软件
  • win7连接宽带
  • WFXSVC.EXE - WFXSVC是什么进程
  • winpatrol.exe - winpatrol是什么进程
  • exeploer.exe
  • 解决win10蓝屏
  • mac系统怎么设置字体大小
  • linux设置静态
  • linux使用mv命令,结果文件不见了
  • js判断浏览器是否为ie
  • 塔防类的网游
  • shell脚本介绍
  • javascript学到什么程度
  • 退伍军人买车需要摇号吗
  • 四川国税发票查验真伪
  • 工商财税小知识
  • 物业优质服务我们在行动
  • 电信宽带欠费滞纳金最多减免多少?
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

    网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

    友情链接: 武汉网站建设