位置: 编程技术 - 正文

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函数

  • 银行手续费回单可以作为入账依据吗
  • 缴纳印花税的会计凭证
  • 企业给员工交公积金国家有规定的
  • 年报会计师审计费用
  • 法人存到公司账户的钱怎么记账
  • 承包费收入如何入账
  • 材料成本差异会计
  • 营业费用率说明什么
  • 收取加盟费会计如何入账
  • 电子增值普通发票经营范围呢免费吗
  • 奖金用现金发放违法吗
  • 银行转贴现业务违法吗
  • 增值税专用发票开票必填项
  • 税务稽查的内容
  • 认缴制下实收资本可以一直为零吗
  • 记账凭证需要哪些人员签章
  • 收到房租发票可以抵扣吗
  • 外出经营地预交税金归主管税务所管吗
  • 净资产是不是包含设备
  • 暂估冲红的分录怎么写
  • 利润分配属于什么科目
  • 未开票收入跨年可以冲回吗
  • 苹果怎么设置屏保和壁纸
  • 几个项目可以合到一起招标吗
  • 如何利用命令符复制文件
  • 文件夹共享设置权限
  • php 字符串函数
  • 广告公司收到广告发票如何入账
  • hipsdaemon.exe是什么
  • npp怎么安装
  • 个人转让门面的法律规定
  • 期初在产品成本是什么
  • 固定资产折旧加计扣除
  • 启动电容坏了的表现
  • 利用php实现一个数组
  • 预定义变量是什么
  • phpcms怎么样
  • docker管理系统
  • 微擎框架开发小程序
  • 计提坏账准备的前提条件
  • 高新企业的所得税
  • CentOS 6.5 x64系统中安装MongoDB 2.6.0二进制发行版教程
  • 营业收入计入销售收入吗
  • 不单独计价的包装物是什么意思
  • 企业营业外收入要交所得税吗
  • 销项税用转出吗
  • 企业收入总额是营业额吗
  • 存在弃置费用的固定资产由于技术进步
  • 记账凭证粘贴顺序银行回单
  • 运费发票抵扣要求
  • 小规模纳税人减按1%怎么计算
  • 股东出资转为借款
  • 垫款报销
  • 代扣代缴个人所得税分录
  • 明细分类核算的依据是什么
  • 合并两公司的帐务处理
  • 年度计提资产减值准备 好还是坏
  • 资本金与注册资本的关系
  • 去年未做账的发票怎么查
  • 会计报表的作用概括起来就是为报表使用者提供会计信息
  • mysql免安装版怎么启动
  • 游戏卡怎么打开
  • windows10体验指数如何查看
  • linux we
  • unityfs 加密反编译
  • js时间日期
  • cocos lua js
  • unity开发用什么电脑比较好
  • 显示自己的ip的手机
  • node.js中的http.response.setHeader方法使用说明
  • IEnumerator/ IEnumerable/ yield return/ StartCoroutine 详解
  • python3 mongodb
  • ug10避让怎么设置
  • python动态加载py
  • 全面解析少女时代关系
  • 个人所得税是哪种税率
  • 2021广东农村医保多少钱一年
  • 河北省云办税厅
  • 我国国家宪法日是每年的十二月几日
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设