Firefox不再在刷新时重新发送POST数据

When you've just sent a form then refresh, if you haven't used the Post/Redirect/Get pattern, Firefox will ask you if you want to resend your form data. If you click Resend, the page would normally reload and the form processing code would do its thing again.

In production, usually, I redirect so this doesn't happen. While developing, though, it can be very useful to be able to refresh and see my debug dumps with the same post data as my code changes, without having to fill the form again or use a tool such as Postman. Just fill the form, die() before the redirect, and test away.

In the last few months, it seems something changed, and Firefox now only pretends to resend the data on a refresh. It still asks me, but even when the following code is the very first thing executed, $_POST is an empty array.

<?php
  echo '<pre>';
  var_dump($_POST);
  echo '</pre>';
  die();
?>

同时,在Chrome上执行相同的步骤确实可以像往常一样将我的$ _POST数组还给我。

我已经下班了几个月,所以我不确定发生了什么变化,但是由于在安全模式下使用Firefox(无附加组件)会产生相同的结果,因此我几乎可以肯定问题出在哪里。我在Mac上使用Firefox 75。

是否有隐藏的首选项可以更改刷新时重新发送POST数据的行为?我可以解决这个问题吗?

评论