本文实例讲述了php常用表单验证类用法。分享给大家供大家参考。具体如下:

<"/^[a-zA-Z0-9]{".$num1.",".$num2."}$/",$str))"/^[0-9]{".$num1.",".$num2."}$/i",$str))"/^[\xa0-\xff]{1,4}$/", $string);
 
  return (preg_match("/^([\x81-\xfe][\x40-\xfe]){".$num1.",".$num2."}$/",$str))"/^((\(\d{3}\))|(\d{3}\-))",$str))"/^[1-9]\d{5}$/",$str))"/^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\"\"])*$/",$str))" "," ",$data[$k1][$k2]);
   $data[$k1][$k2]=str_replace("\n","<br>\n",$data[$k1][$k2]);
   }
   }
   else
   {
   $data[$k1]=nl2br(htmlspecialchars($data[$k1]));
   $data[$k1]=str_replace(" "," ",$data[$k1]);
   $data[$k1]=str_replace("\n","<br>\n",$data[$k1]);
   }
  }
  }
  else
  {
  $data=nl2br(htmlspecialchars($data));
  $data=str_replace(" "," ",$data);
  $data=str_replace("\n","<br>\n",$data);
  }
  Return $data;
}
}
?>

希望本文所述对大家的php程序设计有所帮助。

广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!