- class Fun{
-
- function isEmpty($val)
- {
- if (!is_string($val)) return false; //?????? ??
- if (empty($val)) return false; //?????? ??
- if ($val=='') return false ; //?? ??? ??
- return true
-
- }
- /*
- ----------------- --------- -------------
- ???: isNumber
- ?? ??: ??? ???? ??
- ??: string
- ??: boolean
- ?? ??: ------
- ----- ---------- -------------- ----------
- */
- ?? isNumber($val)
- {
- if(ereg("^[0-9] $", $val))
- true ??;
- false ??;
- }
-
- /*
- ------------------------ --- ------------------
- ??? : isPhone
- ??? ?? : isPhone?? ?????. ??? ?????
- ??: ???
- ??: ??
- ?? ??: ------
- ------ --------------- -----------
- */
- ???Phone( $val)
- {
- //?: xxx -xxxxxxxx-xxx | xxxx-xxxxxxx-xxx ...
- if(ereg("^((0d{2,3})-)(d {7,8})(-(d{3,}) )?$",$val))
- true ??;
- false ??;
- }
- /*
- -------------- ---------------------- -------------
- ?? ?? : isPostcode
- ??? ??: ??? ?????? ??
- ??: ???
- ??: ??
- ?? ??: ------
- --------- ------------------- ------------------
- */
- function isPostcode($val)
- {
- if(ereg("^[0-9] {4,6}$",$val))
- true ??;
- false ??;
- }
-
- /*
- ----------- -------- ---------------- -----
- ?? ??: isEmail
- ??? ??: ??? ?? ??? ??
- ??: ???
- ??: ??
- ?? ??: ------
- - ------------ ------------ ---------
- */
- ?? isEmail($val,$domain ="")
- {
- if(!$domain)
- {
- if ( preg_match("/^[a-z0-9-_.] @[da-z][.w -] .[a-z]{2,4}$/i", $val) )
- {
- return true;
- }
- else
- return false;
- }
- else
- {
- if( preg_match("/^[a-z0-9-_. ] @".$domain."$/i", $val) )
- {
- return true;
- }
- else
- return false;
- }
- }/ /end func
-
- /*
- ----------- ------------ ---------------
- ???: isName
- ??? ??: ??, ?? ??? ??, ???, ??? ?? ??
- ??: ???
- ??: ??
- ?? ??: -------
- - --------------- --------- --------
- */
- ?? isName($val)
- {
- if( preg_match("/^[x80-xffa-zA-Z0-9]{3, 60}$/", $val) )//2008-7-24
- {
- return true;
- }
- return false;
- }//end func
-
-
- /*
- ------------------- ---------------------- -----
- ?? ??: isStrLength($theelement , $min, $max)
- ??? ??: ??? ??? ????? ????? ??
- ??: ??(???, ?? ??, ?? ??)
- ??: ??
- ?? ??: -- ----
- --------------- --------------- ----------------------
- */
- ?? isStrLength($val, $min, $max)
- {
- $ theelement= Trim($val);
- if(ereg("^[a-zA-Z0-9]{" .$min.",".$max."}$",$val))
- true ??;
- false ??;
- }
-
-
- /*
- ---------------------- --------------- ---------
- ?? ??: isNumberLength($theelement, $min , $max)
- ??? ??: ??? ??? ?? ??? ????? ??
- ??: ??(???, ?? ??, ?? ??)
- ??: ??
- ?? ??:------ -
- ------------- ------- --------------
- */
- ?? isNumLength($val, $ min, $max)
- {
- $theelement= Trim($val);
- if(ereg("^[0-9]{".$min.",".$max."} $",$val))
- true ??;
- false ??;
- }
-
- /*
- --- --------------------- ----------------
- ?? ??: isNumberLength ($theelement, $min, $max)
- ?? ??: ??? ??? ?? ??? ????? ??
- ??: ??(???, ?? ??, ?? ??)
- ??: ??
- ?? ??:------
- ---- ----------------------- -------------- ----
- */
- ?? isEngLength($val, $min, $max)
- {
- $theelement=trimm($val);
- if(ereg("^[ a-zA-Z]{".$min.",".$max."}$",$val))
- true ??;
- false ??;
- }
-
- /*
- -------------------------- ------ -------
- ??? : isEnglish
- ??? ?? : ??? ???? ??
- ?? : string
- ??: ??
- ???: ------
- ?? ??: ------
- --- ---------- --------
- */
- function isEnglish($theelement)
- {
- if( ereg("[x80-xff].",$theelement) )
- {
- ?? false;
- }
- ?? true;
- }
-
- /*
- --------------------------------- ------------ -----
- ???: isChina
- ??? ??: ??? ???? ??
- ??: ???
- ??: ??
- ?? ??: ------
- ---------- ------------------------ --------
- */
- /*
- ?? is???($sInBuf)//??? ?? ??
- {
- $iLen= strlen($sInBuf);
- for($i= 0; $i< $iLen; $i )
- {
- if(ord($sInBuf{$i})>=0x80)
- {
- if( (ord($sInBuf{$i})>=0x81 && ord($sInBuf{$i})<=0xFE) && ((ord($sInBuf{ $i 1})>=0x40 && ord($sInBuf{$i 1}) < 0x7E) || (ord ($sInBuf{$i 1}) > 0x7E && ord($sInBuf{$i 1} )<=0xFE)) )
- {
- if(ord($sInBuf{$i})> 0xA0 && ord($sInBuf{$i})<0xAA)
- {
- //??? ??? ??
- return false;
- }
- }
- else
- {
- //??? ?? ?? ???
- return false;
- }
- $i ;
- }
- else
- {
- return false;
- }
- }
- return true;
- }*/
-
-
- function isChina($sInBuf)//??? ??
- {
- if (preg_match("/^[x7f-xff) ] $/", $sInBuf)) { //gb2312, utf-8? ??
-
- return true;
- }
- else
- {
- return false;
- }
- }
- /*
- ---------- ---------------------------- ---------
- ?? ??: isDomain($Domain)
- ??? ??: (??) ??? ??? ????? ??
- ??: ??? ??? ??
- ??: ??
- ?? ??: -------
- --------- -------------- -----------
- */
- ?? isDomain($ ???)
- {
- if(!eregi("^[0-9a-z] [0-9a -z.-] [0-9a-z] $", $Domain))
- {
- false ??;
- }
- if( !eregi(".", $Domain))
- {
- false ??;
- }
-
- if(eregi( "-.", $Domain) ?? eregi("--", $Domain) ?? eregi("..", $Domain) ?? eregi(".-", $Domain))
- {
- ?? false;
- }
-
- $aDomain= ??(".",$Domain);
- if( !eregi("[a-zA-Z]",$aDomain[count($aDomain) )-1]) )
- {
- false ??;
- }
-
- if (strlen($aDomain[0]) > 63 || strlen($aDomain[0]) < ; 1)
- {
- false ??;
- }
- true ??;
- }
- /**
- * ?? ?? ??
- * @paramknown_type $date
- * @paramknown_type $format
- * @throws Exception
- * @return boolean
- */
- ?? verifyDate( $date, $format= 'YYYY-MM-DD')
- {
- ???( $format )
- {
- ??? 'YYYY/MM/DD':
- ??? 'YYYY-MM-DD':
- list( $y, $m, $d ) = preg_split( '/[-./ ]/', $date );
- break;
-
- case 'YYYY/DD/MM':
- ?? 'YYYY-DD-MM':
- list( $y, $d, $m ) = preg_split ( '/[-./ ]/', $date );
- break;
-
- ??? 'DD-MM-YYYY':
- ??? 'DD/MM/YYYY':
- list( $d, $m, $y ) = preg_split( '/[-./ ]/' , $date );
- break;
-
- case 'MM-DD-YYYY':
- case 'MM/DD/YYYY':
- list( $m, $d, $y ) = preg_split( '/[-./ ]/', $date );
- break;
-
- case 'YYYYMMDD':
- $y = substr( $date, 0, 4 );
- $m = substr( $date, 4, 2 );
- $d = substr( $date, 6, 2 );
- break;
-
- ??? 'YYYYDDMM':
- $y = substr( $date, 0, 4 );
- $d = substr( $date, 4, 2 );
- $m = substr( $date, 6, 2 );
- break ;
-
- ???:
- throw new Exception( "??? ?? ??" );
- }
- return checkdate( $m, $d, $y );
- }
-
-
- /*
- --- ----------------------- --------------
- ?? ??: isDate
- ??? ??: ??? 0000-00-00? ????? ?????.
- ??: ???
- ??: ??
- ?? ??: ------
- -------- --------------- ---------------------- -
- */
- ?? isDate($sDate)
- {
- if( ereg("^[0-9]{4}-[][0-9]{2}-[0 -9]{2}$",$sDate) )
- {
- true ??;
- }
- else
- {
- false ??;
- }
- }
- /*
- ----------------------------------------------- --------------------
- ?? ?? : istime
- ??? ?? : ??? ????? 0000-00-00 00:00:00:00
- ?? : ??? ?? : boolean
- ?? ?? : ------
- -------------------------- ----------------------------------------------
- */
- ?? ISTIME ($ stime)
- {
- if (ereg ( "^[0-9] {4}-[] [0-9] {2}-[0-9] {2} [0-9] {2} : [0-9] {2} : [0-9] {2} $ ", $ stime))) return true;
- } {
- return false; }
- }
-
- /* ---------------------------------------------------------- ----- ------------------------------
- ?? ?? : IsMoney ($ val)
- ??? ?? : ?? : ?? ?? ??? ? RMB ?? ?? : ??? ?? : boolean ?? ?? : ------
- ------------- ----------- ----------------------------------
- */ function ismoney ($ val)
- { if (ereg ( "^[0-9] {1,} $", $ val))
- return true; /* ------------------------------------------ ---------- -------
- ?? ?? : ISIP ($ val)
- ??? ?? : ?? IP? ?? ??? ????? ??
- ?? : String
- ?? : ?? ?? ?? : ----
- ---------------------------------- -------------- ----------------------------
- */
- ?? ISIP ($ val) return (bool) ip2long ($ val);
- }
- // ----------------------------------------- ------------------ --------------------------------
-
-
-
- /** * ??? ?? ??
- * @param int $mobile
- /
- function valid_mobile ($ mobile) { if (strlen ($ mobile)! = 11) false; if (preg_match ( '/13 [0-9] d {8} | 15 [0 | 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9] d {8} | 18 [0 | 5 | 6 | 7 | 8 | 9] d {8}/', $ mobile))) {
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * ??? ?? ??? GD2? ???? ?? ?? ????
- *
- * @param string $srcFile ???? ??? ??
- * @param int $toW Thumbnail width
- * @param int $toH ??? ??
- * @param string $toFile ??? ??
- */
- ?? imagizeize ($ srcfile, $ tow, $ toh, $ tofile = "") {
- if ($ tofile == "") {$ tofile = $ srcfile; $ info = ""; switch ($ data [2]) { case 1 :
- if (! function_exists "imageCreateFromgif")) { // echo "GD ?????? GIF ??? ???? ???? ? ? ???? JPEG ?? PNG ??? ??????! & lt; a href = 'javaScript : go (-1);'& gt; return & lt;/a & gt; ";
- return false;
- }
- $ im = imageCreateFromGif ($ srcfile); break ; CASE 2 :
- if (! function_exists ( "imageCreatefromjpeg")) { // echo "GD ?????? jpeg ???? ???? ??? ? ???? ?? ??? ???? ??????!"& lt; a href = 'javaScript : go (-1);'& gt; default & lt;/a & gt; ";
- return false;
- }
- $ im = imageCreatefromjpeg ($ srcfile); break $ im = imagecreateflestfompng ($ srcfile); = $ ftow*($ srch/$ srcw);
- } $ ftoh = $ toh; $toH)
- {
- if(function_exists("createimageTrueColor")){
- @$ni = ImageCreateTrueColor($ ftoW , $ftoH ) > $ni=ImageCreate($ftoW,$ftoH);
- imagecopyresized ($ ni, $ im, 0,0,0,0, $ ftow, $ ftoh, $ srcw, $ srch) else {
- $ ni = imageCreate ($ ftow, $ ftoh); ;);); }
- if (function_exists ( 'ImageJpeg')) imageJpeg ($ ni, $ tofile); else imagepng ($ ni, $ tofile);
- imageStroy ($ ni); } else {
- imageStroy ($ im);
- return false; }
- imageStroy ($ im);
- ?? true;
-
-
- / / ?? >
- ?? ?? strTrim ( $str )
- {
- return preg_replace ( " / s / " " ", $str ); ??> // ???? ?? ?? ?? ??? ?? ($ str, $ type, $ len) if ($ len & lt; strlen ($ str))) {
- > return false; } else { switch ($ type) { case "en"> if (preg_match ( " / ^ [a -za -z] $ / ", $ str))
- {
- return true;
- } else {
- > return false;
- } break;
- case"5 "http : // enclosure
- if (preg_match (" / ^ [a -za -z0-9] $ / ", $ str)) return true; (" / ^ [| - - - - [ / ^ [| - _a-za-z0-9] $/", $ str)))
- {
- return true;
- } else {
- return false;
- } break; $ str = self :: strtrim ($ str); ??> $ str = self :: strtrim ($ str);
- if (preg_match ( "/^([a-z0-9_]] | \-| \.) @([a-z0- 9_] | \-) \.) {1,2} [a-z] {2,4} $/i ", $ str)) {
- return true;
- } else { return false;
- } ?? ?? idcard ($ str) {
- $ str = self :: strtrim ($ str);
- if (preg_match ( "/^([0-9] {15-9]] {17} [0-9a-z]) $/i", $ str )) {
- } else {
- {
- $ strm :: strtrim; } | 0 [0-9] {3})-[0-9] {7.8} $/", $ str)) {
- return true;
- } else {
- ?? Return false ;
- }
- break;
- case "int": if (preg_match ( "/^[0-9] {4}-([0-9] {3} | 0 [0 -9] {3})-[0-9] {7.8} $/", $ str))) return true; } else {
- return false; }
- break;
- }
- } * 2 ?? ??? ?
- * @param 2 ?? ?? $ ARR_DATA
- * @param 1 ?? ?? $ field * /
- getArrayfield ($ arr_data, $ field); ; $ value) { foreach ($ field as $ k = & gt; $ v) {
- if (array_key_exists ($ v, $ value)) // ??? ?
- {
- $ resultarr [$ key] [$ v] = $ value [$ v]; $ resultarr [$ v] = "???? ????"; ??>} }
- }
-
- return $ resultarr;
- /**
- * ????? IP ?? ????
- * @return ip
- */
- ?? get_client_ip(){
- if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown"))
- $ip = getenv("HTTP_CLIENT_IP");
- else if (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "? ? ??"))
- $ip = getenv("HTTP_X_FORWARDED_FOR");
- else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "? ? ??"))
- $ip = getenv("REMOTE_ADDR");
- else if (isset($_SERVER[' REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "? ? ??"))
- $ip = $_SERVER['REMOTE_ADDR'];
- else
- $ ip = "? ? ??";
- return($ip);
- }
-
- function get_http_user_agent(){
- return isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
- }
-
- /**
- * IP ???? ?? ?? ????
- * @param IP $ip
- */
- ?? get_address_from_ip($ip){
- $url='http:// www.youdao.com/smartresult-xml/search.s?type=ip&q=';
- $xml=file_get_contents($url.$ip);
- $data=simplexml_load_string($xml);
- $data->??->??;
- } ??
-
-
- /**
- * ???? ????? ???? ? ??? ? ?? ??? ???? ?????. ?? ??? 6?? ??? ?? ??
- * @param string $len length
- * @param string $type string type
- * ?? 0? ?? 1? ??? 2? ??? 3? ?? ?? 4 ???
- * @param string $addChars ?? ??
- * @return string
- */
- function rand_string($len=6,$type='',$addChars='') {
- $str ='';
- ???($type) {
- ?? 0:
- $chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.$addChars;
- break;
- ?? 1:
- $chars= str_repeat('0123456789' ,3);
- ??;
- ?? 2:
- $chars='ABCDEFGHIJKLMNOPQRSTUVWXYZ'.$addChars;
- ??;
- ?? 3:
- $chars='abcdefghijklmnopqrstuvwxyz'.$ addChars;
- break;
- ?? 4:
- $chars = "??? ? ? ?? ?? ??? ????? ?? ??? ??? ?? ? ?? ??? ??? ?? ???? ?? ???? ?? ? ??? ?????. ?? ???? ?? ?? ?? ???? ?? ????? ???? ???? ?, ??? ?? ??, ?? ??, ??? ?, ?? ?? ??? ??, ??? ??? ?? ? ?? ??, ? ?? ?, ??? ? ?? ??? ?? ???, ???? ??? ???? ? ?? ???? ?? ???? ?? ??? ?? ??? ??? ????. ??? ?? ??? ??? ????, ??, ??? ??, ???, ???, ??? ???? ?? ??? ?? ??? ? ?? ?? ????? ???? ?????. ??? ??, ??, ??? ?? ??? ??? ???? ?? ????? ??? ??? ?? ?? ?? ??? ?? ???? ?? ?????. 4??? ????? ?????? ?? ????? ???? ?? ????? ?? ??? ??? ?? ?? ?? ?? ?? ??? ???? ??? ??. Shiqiang? Tu Shaoji? ????? ??? ???? ????? Jiuyou? Xizhi? Zhiguan, Qimoshan, Cheng Baibao? ????? ?????? ???? ???? ?? ?? ???? ?? ?? ??? ??? ?? ? ????. ??, ??, ?? ?, 6?? ?? ? ?? ?? ?? ???? ??? ?? ? Laolunk? Nanguang?? ??? ?? ??? ?? ??? ??????. ?? ??? ???? ??? ???? ???? ???? ???????. Rashidal Field Weaving Calendar Flower?? ?? ??, ??? ??, ??? ??. ?? ??, ?? ?? ?? ??, ??? ???? ???? ?? ??? ??? ???? ?? 8?? ??? ??? ?????. ??? ??? ???? ?? ?? ??, ??? ???? ??? ? ????. ? Jibai ??? ?? ?? ? ? ?? ???, ??? ?? ??, ?? ?? ??, Xu ?? ??, ?? ?? ?? ???, ?? ??, Hecun ??, ??, Yamo ?? ?? ??, ??? ?, ???? ??, Huang ??, ???? ??? ??? ?????? ?? ???. ??? ???? ?? ?? ??? ??? ?? ?? ???? ??? ?????? ??? ?? ??? ???? Xuanhuan Luoshou Chibo Chengfenjianfu ??? ??? ??? ?? ???? ?? ????? ????? ???? ?? ??? ?? ??? ?????. ?? ?? ?? ???? Qu Chunyuan ?? ???? ?? ?? ?? Taimo ?? ?? Yangjiang ?? Mu Mu Yan Qi Chao Medical School Gu Ni Dao Song Ting Wei Shu Hua ? ? ?? Wei Zi Gu Gang? Liu Wei Lue Fan Gong A Kuai? ?? ??? ????. ??? ??? ?? ??? ?? ??? ??? ?????. Guyuan? Chupi? ??? ?? ? ??? ?? Weiji ?? ? ??? ??? ???? ??? ?????. Late Silk Girl Disperse Welding Gongzhu Yin Leng Che Bounce Disperse Business Visual Art Destroy Edition Lie Zero Room Light Blood Double Deficiency Pump Cha Jue Fu City Chong ???? ?? Jian Fuzhu Li Wangpan Magi Xiong? ?? ? ????. Gong Yizhou? ???? ?? ?? ??? ?????. ??? ?? ??? ?? ??? ???? ?????. ?? ??? ?? ???? ?????. ?? ?? ?? ?? ?? ??????. ??? ?? ??? ???? ??? ??? Luo Ni Pi Sui ?? ?? ? ?? ?? ?? ?? ???? ?? ?? ? Meng Qian ??? ???? ????. ?? ?? ?? ? ?? ?? ?? ?? ?? ?? ?? ??? ?? ?? ?? ??? ? ??? ? ?? ??? ?? ??? ??? ?? ?? ?? ??, ??, ??, ??, ? ??, ???? ??????. ??, ??, ??, ?? ??, ? ?? ???, ???, ??, ???? ?? ??? ?, ?? ??, ???? ??, ???, ?? ?? ???, ?, ?? ?? ???, ???? ???? ?????. ?? ??? ???? ?? ????? ??????. ?? ??? ????. ??? ??, ?? ??, ??????. ?? ? ?? Lan Yinggou B? ?? ??, ?? ?? ??, Yongwa, ?? ??, ?? Xianshun, ??, ?? ??, ??? ??????. ??? ??? ??, ?? ??? ??? ?? ? , ??? ????, ??? ??, ?? ????, ??? ????, ??? ?? ????, ???? ?? ??? ???? ??? ?? ????, ???. ??? ????? ??? ???? ??? ?? ??? ??? ??? ??? ???? ?? ??? ??? ???? ???? ?? ??? ???? ??? ??? ??? ???? ??? ?? ??? ????, ??? ????, ????, ????? ?????, ?? ???, ??? ??, ??? ??? ?????, ??? ???, ?? ????, ?? ?? ??? ????? ??. ?? ??? ?? ??? ?? ? ??? ???, ?? ????, ??? ????, ??? ?????, ?? ????, ???? ??? ???, ??? ??? ???, ??? ????. ??? ?? ??? ?? ??? ???? ??? ??? ?? ??? ????? ??? ???? ???? ??? ???? ???? ???? ??? ???? ??? ? ??? ???? ??? ???, ???? ???? ??? ???, ??? ??, ??? ??? ??? ?? ??? ??, ??? ??? ?? ??? ?? ????, ???, ????? ??? ???? ??? ?? ?? ?? ???? ??? ??? ?? ??? ?? ?? Yi Jingtan Lei Jun ?? Du Lele? ??? ???? Zhao Shao Hu Hu Tong Feng Ling Chai Huang Wu? Shang Ding Qin Shao Zhui Liang?? ?? ?????. ??? ?? ?? ?? ?? ??? ?? He He Che Heng Qin ??? ?? ??? ??? ?? ?? ?? ?? ?? ? ?? ?? ?? Hu Luo Fu Bo League ?? Yang Zong Jiao Sai ?? ?? ??? ?? ?? ?? ?? ?? ??? ?? ? ? ?? ?? ??? ?? ?? ?? ?? ?? ?? ?? ? ?? ? ? ?? ?? ? ? Jianzun Douba Mo ??? ?? ??? ?? ??? ?? ???? ? ?? ? ???? ?? ?? ?? ?? ?? ? ?? ??? ? ?? Kunlang Sa ?? Lun Niang ?? ?? ?? ?? ??? ???? ?? ??? ?? ????. ?? ??? ??? ??? ?? ???? ??, ???? ??, ?? ?, ??? ??, ??? ??, ???? ??, Qiao Tang? ??? ??????. ???? ?? ??? ??, ???? ?? ???? ??? ????, ??? ?????, ???? ???? ????, ???, ???, ??, ??, ???, ???, ???? ????? ??????. ??, ? ??, ?? ???, ?? ??, ??? ???, ??, ??, ??, ??? ??, ?? ?? ???, ???? ??, ??? ??, ?? ??, ???, ?? ?, ??, ??, ?? ?? Sun Linling? ??? ??????. ".$addChars;
- break;
- ?? 5:
- $chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'.$addChars;
- break;
- ???:
- // The ???? ?? ?? oOLl ? ?? 01? ????? ?????. ????? addChars ????
- $chars='ABCDEFGHIJKMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz23456789'.$addChars;
- break;
- }? ?????.
- if($len>10 ) {//???? ?? ??? ???? ?? ?? ?????.
- $chars= $type==1? str_repeat($chars,$len) : str_repeat($chars,5) ;
- }
-
- if($type == 4){ // ??? ??
- $chars = preg_replace('/[^\x{4e00}- \x{9fa5}]/u ', '', $chars); // //utf8? ?? ??? ?????.
- $chars = Chunk_split($chars,3,",") // / /3??? ","? ???? ??? ???? ?????. strlen()? ???? PHP?? ??? 3?? ????? ?????.
- $re =explore(",",$chars);
- shuffle($re);//??? ???? ???
- $chars = implode($re);
- unset($re);
- $str = mb_substr($chars,0,$len," utf-8");
- }else {
- $chars = str_shuffle($chars);
- $str = substr($chars,0,$len);
- }
-
- return $str;
- }
-
- //url?? ???? ? ????
- ?? geturlval($url,$name)
- {
- $arr = parse_url( $url);
- $arr_query = $this-> ;convertUrlQuery($arr['query']);
-
- return $arr_query[$name];
-
- }
- function ConvertUrlQuery($query)
- {
- $ queryParts =Explode('&', $query);
-
- $params = array();
- foreach($queryParts? $param??)
- {
- $item = ??('= ', $param);
- $params[$item[0]] = $item[1];
- }
-
- ?? $params;
- }
- /**
- * ?? ??? ????
- *
- * @param string $url ?? ??? ??
- * @param string $filename ?? ??? ?? ??
- */
- function GrabImage($url, $savepath) {
- if($url =="") {
- return false; //$url? ?? ??? false? ?????.
- }
- $ext_name = strrchr($url, '.') //??? ???? ?????.
- if($ext_name != '. gif' && $ext_name != '.jpg' && $ext_name != '.bmp' && $ext_name != '.png') {
- return false //??? ???? ??? ??????.
- }
- //?? ?? ?? ????
- $filename = $savepath .'\'.end(explode('/',$url));
- //?? ??
- ob_start() ;
- readfile($url);
- $img_data = ob_get_contents() ;
- ob_end_clean();
- $size = strlen($img_data);
- $local_file = fopen($filename , 'a');
- echo $filename;
- if(fwrite( $local_file, $img_data)== FALSE){
- echo '??? ???? ??';
- }
- fclose($ local_file);
- return $filename;
- }
-
- }
- ?>
?? ??
|