手機號,郵箱,郵遞區號的判斷

來源:互聯網
上載者:User

標籤:hex   array   cti   url   郵遞區號   use   decode   turn   phone   

 

public function isEmail($str){$j = "/^[\w|\.][email protected]\w+\.\w+/i";if(preg_match($j,$str))return $str;else return false;}public function isTelphone($str){$j = "/^\d+-?\d+/i";if(preg_match($j,$str))return $str;else return false;}public function isZipCode($str){$j = "/^\d{6}/i";if(preg_match($j,$str))return $str;else return false;}public function isUserName($str){if(HE == ‘utf-8‘){//if(eregi(‘^[\u0391-\uFFE5|\w]{2,40}$‘,$str))if(preg_match(‘/^[\x7f-\xff|\w]{2,40}$/i‘,$str))return $str;else return false;}else return true;}public function isAllowKey($str){//$j = "/^[\w|\[|\]|\-|_]+$/i";$j = "/^[\w|\-|_]+$/i";if(preg_match($j,$str))return $str;else return false;}public function isPassword($str){if(strlen($str)>=6)return $str;else return false;}public function isUrl($str){$j = "/^http:\/\/.+/i";if(preg_match($j,$str))return $str;else return false;}public function subString($str,$lenth,$start = 0){if(strlen($str) < $lenth && !$start)return $str;if(HE == ‘utf-8‘)$l = 3;else $l = 2;$k = 1;if($start){$m = $start;while($k)if(ord($str[--$m]) < 128)$k = 0;$k = $l - ($lenth-$m)%$l;$start = $start + $k;}$t = substr($str,$start,$lenth);$m = $lenth;$k = 1;while($k)if(ord($t[--$m]) < 128)$k = 0;$k = ($lenth-1-$m)%$l;if($k)$t = substr($t,0,$lenth-$k);if($start)return $t;elsereturn $t.‘...‘;}public function hexString($str,$hex = 16){$tmp = "";$e = strlen($str);if(!$e)return false;for($i=0;$i<$e;$i++){$t = base_convert(ord($str[$i]),10,16);$tmp .= "\x{$t}";}return $tmp;}public function encode($info){$info = serialize($info);$key = CS;$kl = strlen($key);$il = strlen($info);for($i = 0; $i < $il; $i++){$p = $i%$kl;$info[$i] = chr(ord($info[$i])+ord($key[$p]));}return urlencode($info);}public function decode($info){$key = CS;$info = urldecode($info);$kl = strlen($key);$il = strlen($info);for($i = 0; $i < $il; $i++){$p = $i%$kl;$info[$i] = chr(ord($info[$i])-ord($key[$p]));}$info = unserialize($info);return $info;}public function enstr($str){$str = base64_encode($str);$str = str_replace(array(‘+‘,‘/‘,‘=‘),array(‘-‘,‘_‘,‘‘),$str);return $str;}public function destr($str){$str = str_replace(array(‘-‘,‘_‘),array(‘+‘,‘/‘),$str);$str = base64_decode($str);return $str;}        

  

手機號,郵箱,郵遞區號的判斷

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.