## PHP
```
/*验证手机号*/
function is_mobile($str){
return preg_math('/^1[34578]{1}\d{9}$/',$str)?true:false;//13 347106430
}
/*验证邮箱号*/
function isEmail($str)
{
return filter_var($str,FILTER_VALIDATE_EMAIL);
}
/*验证微信号*/
function isWeixinid($str)
{
return preg_match('/^[\w-]{4,20}/', $str) !== 0;
}
/*验证密码*/
function verifypasswd($str, $min = 6, $max = 32, $minType = 2)
{
$len = strlen($str);
if ($len < $min || $len > $max) {
return false;
}
$score = 0;
if (preg_match("/\d/", $str))
$score++;
if (preg_match("/[a-z]/", $str))
$score++;
if (preg_match("/[A-Z]/", $str))
$score++;
if (preg_match("/\W/", $str))
$score++;
return $score >= $minType;
}
/*产生字符串*/
function getRandChar($length,$mode = 0)
{
$str = '';
switch ($mode) {
case 3:
$strPol = "123456789";
break;
default:
$strPol = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
break;
}
$max = strlen($strPol) - 1;
while ($length--) {
$str .= $strPol[mt_rand(0, $max)];
}
return $str;
}
```
## Javascript
```
```
网友评论