PHP联系表单返回错误

时间:2013-06-07 13:01:23

标签: php forms captcha contact

我正在尝试在我的网站上实现PHP联系表单,但我遇到了一些错误。您可以填写表单,没有任何问题,电子邮件实际上通过,但不显示感谢页面,它显示一些PHP错误。

Deprecated: Function eregi() is deprecated in /home/travisbass/travismoore.co.uk/include/fgcontactform.php on line 548

Deprecated: Function split() is deprecated in /home/travisbass/travismoore.co.uk/include/class.phpmailer.php on line 470

Warning: Cannot modify header information - headers already sent by (output started at /home/travisbass/travismoore.co.uk/include/fgcontactform.php:548) in /home/travisbass/travismoore.co.uk/include/fgcontactform.php on line 143

I am using the code from this website

Here is the page of my website

Code for class.phpmailer.php

Code for fgcontactform.php

如果您需要更多信息,请与我们联系。

感谢任何帮助, 感谢

2 个答案:

答案 0 :(得分:7)

这些信息可以解释为您解决问题:

eregi() - >删除此功能,因为它已弃用并替换为preg_match()

split() - >删除此功能并将其替换为explode()或使用preg_split()

已发送

标题 - >在发送任何标头之前确保没有HTML。有关详细信息,请参阅此处:How to fix "Headers already sent" error in PHP

在这里,您可以阅读PHP 5.3.x中更多已弃用的函数 - > http://php.net/manual/en/migration53.deprecated.php

答案 1 :(得分:0)

尝试:

return (1 === preg_match('/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i', $email));