gpt4 book ai didi

PHP 安全 : send POST to same URL = bad?

转载 作者:可可西里 更新时间:2023-11-01 13:57:45 25 4
gpt4 key购买 nike

我昨天收到了关于将 POST 数据发送到与 Post-Redirect-Get pattern 相同的页面的问题的答复。像这样:

if (isset($_POST['Submit'])) {
// prevent resending data
header("Location: " . $_SERVER['PHP_SELF']);
}

有人回复:sending data to same PHP page from Javascript, no AJAX or forms

It is extremely important for the purposes of web security that a POST cannot be sent via a simple URL.

现在我想知道这有什么问题?我想避免使用带有确认消息的单独页面,因为它只会破坏用户体验,而且从设计 POV 来看,这是不行的。

最佳答案

It is extremely important for the purposes of web security that a POST cannot be sent via a simple URL.

我认为说这话的人可能误解了您或网络安全。

对于不同的请求方法(GETPOSTPUTDELETE)使用相同的 URL 没有错>、HEAD 等)。事实上,这是一个非常好的主意。

关于PHP 安全 : send POST to same URL = bad?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4022201/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com