| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @desc 检测用户名格式 |
| | | * @param $str |
| | | * @return bool |
| | | */ |
| | | function CheckRegUser($str) { |
| | | if (!preg_match("/^[\x{4e00}-\x{9fa5}A-Za-z0-9\-@#.\$_!]+$/u", $str)) { |
| | | return FALSE; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 检测电话号码 |
| | | * @param $str |
| | | * @return bool |
| | | */ |
| | | function CheckTell($str) { |
| | | if (preg_match("/^[0-9-]+?$/", $str) == 0) { |
| | | return FALSE; |
| | |
| | | */ |
| | | function avgToYm($long) { |
| | | if ($long >= 12) { |
| | | if (bcmod($long, 12) > 0) { |
| | | $return = floor($long / 12) . '年' . bcmod($long, 12); |
| | | } else { |
| | | $return = floor($long / 12) . '年'; |
| | | } |
| | | |
| | | $return = floor($long / 12) . '年'; |
| | | } else { |
| | | $return = $long; |
| | | } |