PHP中EREGI的替代函数

时间:2013-01-07 06:50:57

标签: php regex preg-match eregi

我正在再次制作联系表格,并且正在使用eregi()。但是众所周知,eregi()函数已经在PHP 5.3上被弃用了,所以我想知道我可以用什么替代函数替换函数eregi()?我试过了!preg_match,即使我得到了所需的输出,但似乎仍然存在错误! →3<

  

警告: preg_match():分隔符不得为第38行 C:\ xampp \ htdocs \ Wall \ mailform.php 中的字母数字或反斜杠< /强>   (检测到可能的垃圾邮件尝试。如果不是这种情况,请编辑联系表单的内容,然后重试。) - ()中的句子是所需的结果。

这是我使用的代码。 !preg_match()曾经是eregi()。 :)

function spamcheck($field) {
    if(!preg_match("to:",$field) || !preg_match("cc:",$field) || !preg_match("\r",$field) || !preg_match("\n",$field) || !preg_match("%0A",$field)){ 
        $possiblespam = TRUE;
    }else $possiblespam = FALSE;
    if ($possiblespam) {
        die("Possible spam attempt detected. If this is not the case, please edit the content of the contact form and try again.");
        return 1;
    }
}

感谢无论谁回答并帮助我。非常感谢任何形式的帮助!

0 个答案:

没有答案