在PHP中,如果redirect参数中带有id,可以通过以下几种方式解决:
$id = $_GET['id'];
header("Location: http://example.com/page.php?id=$id");
exit;
$id = $_GET['id'];
$id = urlencode($id);
header("Location: http://example.com/page.php?id=$id");
exit;
$id = $_GET['id'];
session_start();
$_SESSION['id'] = $id;
header("Location: http://example.com/page.php");
exit;
在页面重定向后,可以通过$_SESSION[‘id’]获取之前存储的id参数。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读:php中redirect的作用是什么