【发布时间】:2017-12-08 11:24:36
【问题描述】:
我正在使用 GET 方法以选择形式传递多个参数。表单提交后,我想在 URL 中隐藏 4 个参数中的 3 个。我有一个包含 4 个值的选项,我将它们分解并得到每个值:
<select name="hardware">
<option value="Bitmain AntMiner S9|1-btc-sha-256|14000|1375">BITMAIN AntMiner S9</option>
<option value="Bitmain AntMiner D3|34-dash-x11|15000|1200">BITMAIN AntMiner D3</option>
</select>
<?php
$hardware = $_GET["hardware"];
$hardware_explode = explode('|', $hardware);
echo $hardware_explode[0];
echo $hardware_explode[1];
echo $hardware_explode[2];
echo $hardware_explode[3];
?>
在 URL 中是这样的:example.com/calculate.php?hardware=Bitmain+AntMiner+S9%7C1-btc-sha-256%7C13000%7C1375
我希望它是example.com/calculate.php?hardware=Bitmain+AntMiner+S9
如何在 JS 或 PHP 中隐藏最后 3 个参数?
【问题讨论】:
-
使用
POST而不是GET,不能选择性隐藏 -
如果我们知道为什么可能会有所帮助 - 你想在另一端对它们做什么以及为什么要隐藏它们?
-
这绝对是xyproblem.info 使用
GET意味着您可以为结果添加书签。如果没有必要,请使用POST。如果您希望结果可收藏,请将实际信息替换为 id,就像 Quentin 建议的那样,并确定后端中的哈希数据。 -
@Chakachuk 由于尚未建议,您可以使用
header("Location: calclate.php?hardware=...");重定向到另一个 URL
标签: javascript php parameters get hide