<?php
require_once 'Zend/Validate/EmailAddress.php';
function c_email($email)
{
$validator = new Zend_Validate_EmailAddress();
if($validator->isValid($email)){
echo "输入的E-mail地址:";
echo $email."有效!<p>";
}else{
echo "输入的E-mail地址:";
echo $email."无效!";
echo "失败消息为:<p>";
foreach($validator->getMessages() as $message){
echo $message."<p>";
}
foreach($validator->getErrors() as $error){
echo $error."<p>";
}
}
}
$e_m1 = "abc@123.com";
$e_m2 = "abc#123.com";
c_email($e_m1);
c_email($e_m2);
public function isValid($value)
{
if (!is_string($value)) {
$this->_error(self::INVALID);
return false;
}
$matches = array();
$length = true;
$this->_setValue($value);
// Split email address up and disallow '..'
if ((strpos($value, '..') !== false) or
(!preg_match('/^(.+)@([^@]+)$/', $value, $matches))) {
$this->_error(self::INVALID_FORMAT);
return false;
}
$this->_localPart = $matches[1];
$this->_hostname = $matches[2];
if ((strlen($this->_localPart) > 64) || (strlen($this->_hostname) > 255)) {
$length = false;
$this->_error(self::LENGTH_EXCEEDED);
}
// Match hostname part
if ($this->_options['domain']) {
$hostname = $this->_validateHostnamePart();
}
$local = $this->_validateLocalPart();
// If both parts valid, return true
if ($local && $length) {
if (($this->_options['domain'] && $hostname) || !$this->_options['domain']) {
return true;
}
}
return false;
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有