$loc1=strpos($email,'@');
$loc2=strrpos($email,'@');
if($loc1==false){
exit('邮箱格式不正确<br/>'.$redirectUrl);
}else if($loc1!==$loc2){ //出现多次'@',邮箱格式也是不正确的
exit('邮箱格式不正确<br/>'.$redirectUrl);
}
$loc2=strrpos($email,'@');
if($loc1==false){
exit('邮箱格式不正确<br/>'.$redirectUrl);
}else if($loc1!==$loc2){ //出现多次'@',邮箱格式也是不正确的
exit('邮箱格式不正确<br/>'.$redirectUrl);
}
2017-03-24
<?php
$str='1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
echo $str{rand(0,strlen($str))}.$str{rand(0,strlen($str))}.$str{rand(0,strlen($str))}.$str{rand(0,strlen($str))};
$str='1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
echo $str{rand(0,strlen($str))}.$str{rand(0,strlen($str))}.$str{rand(0,strlen($str))}.$str{rand(0,strlen($str))};
2017-03-07
$str = '1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM';
for($i=0;$i<4;$i++){
echo $str{mt_rand(0,strlen($str)-1)};
}
for($i=0;$i<4;$i++){
echo $str{mt_rand(0,strlen($str)-1)};
}
2017-02-25