Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/241.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用post在标题中传递php变量_Php - Fatal编程技术网

用post在标题中传递php变量

用post在标题中传递php变量,php,Php,我想通过post在标题中传递一个php变量,get很容易,但我想使用post将其隐藏在url中 第1页 $password=$tab['password_view']; header("location:page2.php"); 第2页 echo $password; 第1页: <?php session_start(); $_SESSION['my_saved_variable'] = $my_local_variable; 你不能。改为使用会话。老天,不要在会话或标题中传递密码

我想通过post在标题中传递一个php变量,get很容易,但我想使用post将其隐藏在url中

第1页

$password=$tab['password_view'];
header("location:page2.php");
第2页

echo $password;
第1页:

<?php

session_start();
$_SESSION['my_saved_variable'] = $my_local_variable;

你不能。改为使用会话。老天,不要在会话或标题中传递密码,也不要在安全区域/方法之外的任何地方传递密码。你要求的是T-R-O-U-B-L-E。类似会话的劫持不再存在@rjdown,我永远不会建议这样做。我不会建议这样做。听说过会话劫持吗?不管怎样,我都不推荐。我也不会用密码。仅演示如何使用会话变量跨页面获取持久化变量。
<?php

session_start();
echo $_SESSION['my_saved_variable'];