没有错误,但代码不起作用

No errors but code doesnt work

我创建了一个联系表单,但我现在似乎无法在代码中找到错误,我的问题是当我单击“提交”按钮时它 returns 一个空白页面,没有显示任何错误。

This is the result I get

Link to the script contact.html(php actually)

报错可能是没有设置显示错误,不代表有none.

将以下行添加到您的 php 页面:

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

然后您会看到错误。

如果您不希望显示错误并且它是对您的 php 脚本的 ajax 请求,您可以 console.log 服务器响应到您的 javascript 请求处理程序:)