是否可以在电子邮件表单中使用点.
检查器,这样,如果特定字段有点,则会告诉用户不要在这些字段中放置点。我尝试过这个,但不起作用:
if (eregi('.', $notes)) {
die ("Do NOT PUT DOT HERE");
}
那么,你知道该怎么办吗?
如手册所述:
提示:如果只想检查一个字符串是否包含在另一个字符串中,请不要使用preg_match()。请改用strpos()或strstr(),因为它们会更快。
这是strpos()方法:
<?php
$findme = '.';
$pos = strpos($notes, $findme);
if ($pos !== false) {
echo "Do NOT PUT DOT HERE";
} else {
//other
}
?>
在大多数情况下,我不建议退出。
if (preg_match('~'.~', $notes)) {
// Do something useful
}