我想通过 header 传递一个变量。在我的系统中,用户停留在个人资料页面上,然后单击链接来填写并提交表单。提交表单后,页面重定向到个人资料页面。当我的个人资料页面显示成员(member)ID已丢失,因此它不显示成员(member)详细信息。我想要做的是在重定向发生时传递成员 ID。
function redirect_to($location = NULL){
if($location != NULL){
header("Location:{$location}");
exit;
}
}
redirect_to('member_profile.php');
我想做的是这个
redirect_to('member_profile.php?id=$mselcted_memberI');
最佳答案
您使用的是单引号 '
,这将使其成为文字字符串,而是使用 .
连接它
redirect_to('member_profile.php?id='.$mselcted_memberI);
此外,此处不需要大括号 {}
header("Location:$location");
关于php - 通过 header 传递 php 变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20819270/