邮箱验证代码大都是不能验证一个字母的域名或一个字母的用户名,如:i@phpfensi.com 或 i@phpfensi.net,解决方法如下:
1,不做总长度判断,长度判断可以自己加上;2,支持.net.cn,.com.cn这样的域名后缀;3,邮箱名部分以字母或者数字开头,中间可以有“-”与“_”符号;4,域名部分以字母或者数字开头,中间可以有“-”与“_”符号;
PHP 邮箱验证正则表达式,代码如下:
preg_match("/^[0-9a-zA-Z]+@(([0-9a-zA-Z]+)[.])+[a-z]{2,4}$/i",$email );
实例代码如下:
- /**
- * 自己修整的一个邮箱正则表达式
- * php粉丝网
- */
- echo '<meta charset="utf-8" />';
- function c_email($email){
- $reg='/^([a-zA-Z0-9]{1,20})(([_-.])?([a-zA-Z0-9]{1,20}))*@([a-zA-Z0-9]{1,20})(([-_])?([a-zA-Z0-9]{1,20}))*(.[a-z]{2,4}){1,2}$/';
- if(preg_match($reg,$email))
- return true;
- return false;
- }
- $email = 'mail@lizhong.me';
- $check_result = c_email($email);
- if($check_result){
- echo '邮箱格式正确';
- }else{
- echo '邮箱格式错误';
- }
邮箱验证类,代码如下:
- <?php
- class Reg
- {
- public $mail;
- function __construct()
- {
- $this->mail = $_POST["mail"];
- }
- function RegMail()
- {
- if(preg_match("/^[0-9a-zA-Z]+(?:[_-][a-z0-9-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*.[a-zA-Z]+$/i", $this->mail))
- {
- echo "<script language='javascript'>alert('验证成功')</script>";
- }
- else
- {
- echo "<script language='javascript'>alert('验证失败')</script>";
- }
- }
- }
- $r = new Reg();
- $r->RegMail();
- $strings = "abc@163.com";
- if(preg_match("/^[0-9a-zA-Z]+(?:[_-][a-z0-9-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*.[a-zA-Z]+$/i",$strings))
- {
- echo"验证成功!是邮箱地址。";
- }
- else
- {
- echo"不是邮箱地址!";
- }
- ?>
波比源码 – 精品源码模版分享 | www.bobi11.com
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 本站源码并不保证全部能正常使用,仅供有技术基础的人学习研究,请谨慎下载
8. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!
波比源码 » php正则表达式验证邮箱
波比源码 » php正则表达式验证邮箱
levofloxacin sale levofloxacin buy online
buy avodart online cheap buy avodart online zofran 8mg price
order sildenafil online buy tamoxifen 10mg online order methocarbamol 500mg online
generic indomethacin 75mg order indocin 50mg generic amoxicillin 250mg oral
order arimidex 1mg for sale generic viagra testimonials sildenafil 100mg cost
cialis pas cher cialis 20mg gГ©nГ©rique viagra 200mg prix
cialis ohne rezept tadalafil generika viagra 50mg kaufen für männer
generic provigil 100mg provigil 200mg cost order acetazolamide pill
buy doxycycline for sale buy generic lasix order generic furosemide 100mg
altace 5mg price buy irbesartan online astelin 10 ml us
buy alendronate sale buy alendronate 35mg pills buy famotidine 20mg without prescription
olmesartan online acetazolamide 250 mg usa diamox canada
prograf ca urso 300mg ca order ursodiol without prescription
buy isosorbide 40mg online order lanoxin for sale telmisartan price
revia 50 mg pills generic femara order abilify sale
order generic avlosulfon 100mg avlosulfon 100mg drug purchase perindopril pill
order medroxyprogesterone 10mg hydrochlorothiazide 25 mg brand cyproheptadine buy online
azithromycin 250mg without prescription zithromax 500mg usa cost neurontin 800mg
buy metoprolol 50mg online cheap buy metoprolol without prescription vardenafil 20mg canada
top essay writers professional research paper writers overnight delivery viagra
clomid medication cheap albuterol online slots real money
buy cialis without prescription buy cialis 10mg generic order sildenafil 100mg generic
purchase tadalafil generic order generic tadalafil 20mg buy plavix 75mg for sale
oral domperidone 10mg buy sumycin sale purchase cyclobenzaprine generic
flomax over the counter aldactone canada order spironolactone 25mg
order keflex 500mg online erythromycin 500mg cost erythromycin 500mg usa
order tadalafil 20mg without prescription sildenafil 50mg viagra 50mg cheap
thesis writing services order stromectol for sale ivermectin 0.2mg
deltasone 10mg price buy deltasone purchase mebendazole
biaxin 250mg over the counter order antivert for sale oral meclizine 25 mg
tiotropium bromide 9 mcg pills order hytrin 1mg for sale hytrin over the counter
buy generic singulair 5mg cheap viagra for sale buy sildenafil online cheap
order tadalafil 5mg for sale cialis for men over 50 buy cialis 20mg generic
online gambling for real money casino slot live online blackjack
order nifedipine 10mg without prescription adalat ca allegra canada
order asacol 400mg without prescription order azelastine 10ml sprayers order irbesartan 300mg sale
amoxicillin 1000mg uk stromectol over the counter ivermectin for humans
buy dapoxetine 90mg pills order avana 100mg order domperidone sale
indocin online indomethacin 75mg over the counter cenforce 100mg sale
buy pepcid pills pepcid 40mg brand order remeron 15mg pill
order fenofibrate 160mg pill cheap viagra sale sildenafil viagra
buy esomeprazole 40mg pill nexium generic brand furosemide
purchase minocycline online generic minocycline 100mg order hytrin online
glucophage tablet order glycomet 500mg generic nolvadex 10mg pill
order clomiphene online cheap buy clomiphene generic prednisolone medication
ivermectin 1 cream generic cheap stromectol 6mg buy deltasone 20mg generic
order accutane 10mg without prescription buy generic amoxicillin 250mg zithromax pills
prednisolone online buy purchase gabapentin sale cost lasix 100mg
vibra-tabs online purchase vardenafil for sale buy acyclovir 800mg generic
order ditropan 5mg generic buy prograf 1mg pills buy trileptal 300mg without prescription
cefdinir us protonix 20mg uk order pantoprazole generic
zetia oral methotrexate pill methotrexate 10mg pills
buy levaquin paypal ursodiol over the counter buy bupropion 150mg without prescription
oral medex cheap coumadin 5mg order allopurinol pill
brand lexapro 10mg sarafem for sale online revia pills
cheap online pharmacy
cialis 40mg ca buy tadalafil how to buy ed pills
online pharmacy without a prescription
ivermectin tablets buy prednisone 40mg order generic isotretinoin
buy amoxicillin order prednisolone 40mg sale prednisolone 5mg cost
order neurontin 800mg generic neurontin 100mg pills buy monodox online
canadian pharmacy online ship to usa
canadian pharmacies recommended by aarp
pharmacies not requiring a prescription
buy prednisolone generic generic neurontin 800mg buy lasix 100mg generic
doxycycline 200mg uk how to buy clavulanate augmentin 375mg ca
tenormin 50mg cost buy atenolol medication femara 2.5 mg cost
medicine canada
praziquantel 600mg usa hydrochlorothiazide 25mg oral buy periactin sale
order methotrexate 2.5mg sale buy generic methotrexate 10mg metoclopramide order
best mexican online pharmacies
xenical drug buy allopurinol 300mg online cheap purchase allopurinol online cheap
purchase cozaar online cheap buy esomeprazole paypal order topiramate 100mg pills
crestor price order motilium 10mg online cheap buy motilium
imitrex 25mg pills order avodart 0.5mg online cheap buy avodart online cheap
brand zantac 150mg buy celebrex 100mg online cheap order celecoxib 100mg generic
buy generic plavix online buy plavix 150mg without prescription order ketoconazole 200 mg without prescription
where to buy duloxetine without a prescription buy generic duloxetine order piracetam online
canadian prescription drugstore
ipratropium cost cheap ipratropium purchase zyvox sale
legitimate canadian pharmacy online
buy generic carbamazepine cheap carbamazepine order lincomycin for sale
purchase avana generic voltaren for sale online cambia price
indocin 50mg over the counter buy suprax medication suprax for sale online
buy careprost paypal order robaxin 500mg pill order desyrel 100mg online cheap
trimox drug buy arimidex 1mg pills oral clarithromycin
catapres 0.1mg over the counter spiriva 9 mcg cost tiotropium bromide 9 mcg for sale
buy isotretinoin 10mg zithromax 500mg sale order azithromycin 500mg without prescription
order cialis 40mg for sale cheap tadalafil 5mg cialis medication
cost furosemide 40mg furosemide 100mg sale albuterol pills
buy generic altace buy ramipril medication purchase arcoxia for sale
buy levitra online cheap buy hydroxychloroquine 200mg pills buy hydroxychloroquine generic
mesalamine cheap astelin 10ml nasal spray purchase irbesartan sale
vardenafil 10mg uk tizanidine where to buy buy plaquenil online
clobetasol oral where to buy temovate without a prescription buy amiodarone cheap
order olmesartan without prescription order olmesartan 20mg pills cost divalproex 500mg
clobetasol oral cost clobetasol how to get amiodarone without a prescription
buy generic diamox order azathioprine 50mg without prescription imuran 25mg us
oral lanoxin 250mg purchase lanoxin generic buy molnunat paypal