加入收藏 | 设为首页 | 会员中心 | 我要投稿 广州站长网 (https://www.020zz.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

推荐使用哪两种方式来传递变量php?

发布时间:2022-11-25 22:30:50 所属栏目:PHP教程 来源:互联网
导读: Most secure way to temporary store any value for future use in PHP is session. 临时存储任何值以供将来在PHP中使用的最安全的方法是会话。 Session is super global variable of php

Most secure way to temporary store any value for future use in PHP is session. 临时存储任何值以供将来在PHP中使用的最安全的方法是会话。 Session is super global variable of php and available at everywhere. 会话是php的超级全局变量,可在任何地方使用。

You can store all datatype values in session like integer, float, boolean or array as well. 您也可以将所有数据类型值存储在会话中,例如整数PHP变量,浮点数,布尔值或数组。

After submitting your form, do process it and store expected values in session. 提交表单后,请进行处理并将期望值存储在会话中。 Then use it on another page. 然后在另一页上使用它。 After use unset its value. 使用后取消设置其值。 Below is the example how you can set session. 下面是如何设置会话的示例。

<?php
$_SESSION['myValue'] = 'your value to store'; //assign value to session.
echo $_SESSION['myValue']; // print value of session. If it store array then use print_r() to see values.
unset($_SESSION['myValue']); // unset session value
?>

(编辑:广州站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!