php
Zend_Validate_EmailAddress
和filter_var(..., FILTER_VALIDATE_EMAIL)
,这在验证电子邮件地址时更好,为什么?
Both can be used to validate an email address, but Zend_Validate_EmailAddress
is more powerful. While filter_var is a simple yes or no validator, there are many options which can change how strict Zend_Validate_EmailAddress is.
You can choose which parts to validate, rules for validating those parts, and even to validate MX records.
Finally, Zend_Validate_EmailAddress can be readily used in combination with Zend_Filter_Input
and Zend_Form
where filter_var can't.
上一篇: 使用PHP的explode()进行HTML抓取被认为是一种不好的做法?
下一篇: PHP