PHP code for form data verification

Source: Internet
Author: User
Tags ereg imagejpeg
This article describes how to implement form data verification in PHP Code. For more information, see

This article describes how to implement form data verification in PHP Code. For more information, see

The following PHP code is used to implement the form data verification class. The details are as follows:

Easy to use and convenient form data verification

<? Php // verification class Fun {function isEmpty ($ val) {if (! Is_string ($ val) return false; // if (empty ($ val) return false; // if ($ val = '') is set '') return false; // whether it is null return true;}/* ----------------------------------------------------------- function name: isNumber Brief Description: Check whether the input is a number input: string output: boolean modify log: ------ else */function isNumber ($ val) {if (ereg ("^ [0-9] + $", $ val) return true; return false ;}/*---------- --------------------------------------------- Function name: isPhone Brief Description: Check whether the input is phone input: string output: boolean modify log: ------ handler */function isPhone ($ val) {/eg: xxx-xxxxxxxx-xxx | xxxx-xxxxxxx-xxx... if (ereg ("^ (0 \ d {2, 3})-) (\ d {7, 8}) (-(\ d {3 ,}))? $ ", $ Val) return true; return false;}/* ----------------------------------------------------------- function name: isPostcode Brief Description: Check whether the input is a zip code input: string output: boolean modification log: ------ --------------------------------------------------------- */function isPostcode ($ val) {if (ereg ("^ [0-9] {} $", $ val) return true; return false ;} /* ------------------------------------------------------------- function name: Brief description of isEmail: Enter the email address validity check: str Ing output: boolean modify log: ------ ----------------------------------------------------------- */function isEmail ($ val, $ domain = ") {if (! $ Domain) {if (preg_match ("/^ [a-z0-9-_.] + @ [\ da-z] [\. \ w-] + \. [a-z] {2, 4} $/I ", $ val) {return true;} elsereturn false ;} else {if (preg_match ("/^ [a-z0-9-_.] + @". $ domain. "$/I", $ val) {return true;} elsereturn false;} // end func/* alias function name: isName Brief Description: Check the name nickname validity, only Chinese and English input can be entered: string output: boolean modify log :------------------------------------------------------------- ---- */Function isName ($ val) {if (preg_match ("/^ [\ x80-\ xffa-zA-Z0-9] {} $/", $ val )) // {return true;} return false;} // end func/* ------------------------------------------------------------- function name: isStrLength ($ theelement, $ min, $ max) Brief description: check whether the string length meets the requirements input: mixed (string, minimum length, maximum length) Output: boolean modify log: ------ ------------------------------------------------- */function isStrLength ($ val, $ min, $ Max) {$ theelement = trim ($ val); if (ereg ("^ [a-zA-Z0-9] {". $ min. ",". $ max. "} $", $ val) return true; return false;}/* ------------------------------------------------------------- function name: isNumberLength ($ theelement, $ min, $ max) Brief description: check whether the string length meets the requirements input: mixed (string, minimum length, maximum length) Output: boolean modify log: ------ --------------------------------------------------- */function isNumLength ($ val, $ min, $ max) {$ theelement = trim ($ v Al); if (ereg ("^ [0-9] {". $ min. ",". $ max. "} $", $ val) return true; return false;}/* ------------------------------------------------------------- function name: isNumberLength ($ theelement, $ min, $ max) Brief description: check whether the string length meets the requirements input: mixed (string, minimum length, maximum length) Output: boolean modify log: ------ running */function isength ($ val, $ min, $ max) {$ theelement = trim ($ val); if (ereg ("^ [a-zA-Z] {". $ min. ", ". $ Max. "} $", $ val) return true; return false;}/* ----------------------------------------------------------- function name: isEnglish Brief Description: Check whether the input is an English input: string output: boolean Author: ------ modify log: ------ ----------------------------------------------------------- */function isEnglish ($ theelement) {if (ereg ("[\ x80-\ xff]. ", $ theelement) {Return false;} Return true ;}/*----------------------------------------------------------- Function Name: isChinese Brief Description: Check whether the input is a Chinese character input: string output: boolean modify log: ------ --------------------------------------------------- * // * function isChinese ($ sInBuf) // problematic function {$ 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 ($ sIn Buf {$ I + 1}) <= 0xFE) {if (ord ($ sInBuf {$ I})> 0xA0 & ord ($ sInBuf {$ I }) <0xAA) {// return false;} else {// return false;} $ I ++;} else {return false ;}} return true;} */function isChinese ($ sInBuf) // The correct function {if (preg_match ("/^ [\ x7f-\ xff] + $ /", $ sInBuf) {// compatible with gb2312, utf-8return true;} else {return false ;}/ * empty function name: isDomain ($ Domain) Brief Description: Check one (English) enter a valid Domain Name: String Domain name output: boolean modification log: --------------------------------------------------------------- */function isDomain ($ Domain) {if (! Eregi ("^ [0-9a-z] + [0-9a-z \.-] + [0-9a-z] + $", $ Domain) {Return false;} if (! Eregi ("\. ", $ Domain) {Return false;} if (eregi ("\-\. ", $ Domain) or eregi (" \-", $ Domain) or eregi ("\. \. ", $ Domain) or eregi ("\. \-", $ Domain) {Return false;} $ aDomain = explode (". ", $ Domain); if (! Eregi ("[a-zA-Z]", $ aDomain [count ($ aDomain)-1]) {Return false ;} if (strlen ($ aDomain [0])> 63 | strlen ($ aDomain [0]) <1) {Return false;} Return true ;} /*** date verification function * @ param unknown_type $ date * @ param unknown_type $ format * @ throws Exception * @ return boolean */function validateDate ($ date, $ format = 'yyyy-MM-DD ') {switch ($ format) {case 'yyyy/MM/dd': case 'yyyy-MM-DD': list ($ y, $ m, $ d) = preg_split ('/[-. /]/ ', $ Date); break; case 'yyyy/DD/mm': case 'yyyy-DD-MM': list ($ y, $ d, $ m) = preg_split ('/[-. /]/', $ date); break; case 'dd-MM-YYYY': case '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); B Reak; case 'yyyyddmm': $ y = substr ($ date, 0, 4); $ d = substr ($ date, 4, 2 ); $ m = substr ($ date, 6, 2); break; default: throw new Exception ("Invalid Date Format");} return checkdate ($ m, $ d, $ y);}/* callback function name: isDate Brief Description: Check whether the date complies with objective-00-00 input: string output: boolean modify log: required */function isDate ($ sDa Te) {if (ereg ("^ [0-9] {4} \-[] [0-9] {2} \-[0-9] {2} $ ", $ sDate) {Return true;} else {Return false;}/* --------------------------------------------------------- function name: isTime Brief Description: Check whether the date meets 0000-00-00 00:00:00 input: string output: boolean modification log: ----------------------------------------------------------------- */function isTime ($ sTime) {if (ereg ("^ [0-9] {4} \-[] [0-9] {2} \-[0-9] {2} [0-9- 9] {2 }: [0-9] {2}: [0-9] {2} $ ", $ sTime) {Return tr Ue;} else {Return false;}/* --------------------------------------------------------- function name: isMoney ($ val) Brief Description: Check whether the input value is in valid RMB format input: string output: boolean modify log: logs */function isMoney ($ val) {if (ereg ("^ [0-9] {1 ,}$", $ val) return true; if (ereg ("^ [0-9] {1 ,}\. [0-9] {1, 2} $ ", $ val) return true; return false ;}/*--------------------------------------------------- -------- Function name: isIp ($ val) Brief Description: Check whether the input IP meets the requirements input: string output: boolean modify log: ----------------------------------------------------------- */function isIp ($ val) {return (bool) ip2long ($ val);} // verify/*** verify mobile phone number * @ param int $ mobile */function valid_mobile ($ mobile) {if (strlen ($ mobile )! = 11) return 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;}/*** thumbnail generation function, it is best to use GD2 ** @ param string $ srcFile to generate a thumbnail file * @ param int $ toW thumbnail width * @ param int $ toH thumbnail height * @ param string $ toFile thumbnail file * /function ImageResize ($ srcFile, $ toW, $ toH, $ toFile = "") {if ($ toFile = "") {$ toFile = $ srcFile;} $ info = ""; $ data = GetImageSize ($ srcFil E, $ info); switch ($ data [2]) {case 1: if (! Function_exists ("imagecreatefromgif") {// echo "your GD library cannot use images in GIF format. use Jpeg or PNG format! Return "; return false ;}$ im = ImageCreateFromGIF ($ srcFile); break; case 2: if (! Function_exists ("imagecreatefromjpeg") {// echo "your GD library cannot use jpeg images. Please use images in other formats! Return "; return false ;}$ im = ImageCreateFromJpeg ($ srcFile); break; case 3: $ im = ImageCreateFromPNG ($ srcFile); break ;} $ srcW = ImageSX ($ im); $ srcH = ImageSY ($ im); $ toWH = $ toW/$ toH; $ srcWH = $ srcW/$ srcH; if ($ toWH <= $ srcWH) {$ ftoW = $ toW; $ ftoH = $ ftoW * ($ srcH/$ srcW);} else {$ ftoH = $ toH; $ ftoW = $ ftoH * ($ srcW/$ srcH);} if ($ srcW> $ toW | $ srcH> $ toH) {if (function_exists ("imagecreatetruecolor ")) {@ $ ni = ImageCreateTrueColor ($ ftoW, $ ftoH); if ($ ni) ImageCopyResampled ($ ni, $ im, 0, 0, 0, 0, $ ftoW, $ ftoH, $ srcW, $ srcH); else {$ ni = ImageCreate ($ ftoW, $ ftoH); ImageCopyResized ($ ni, $ im, 0, 0, 0, $ ftoW, $ ftoH, $ srcW, $ srcH) ;}} else {$ ni = ImageCreate ($ ftoW, $ ftoH); ImageCopyResized ($ ni, $ im, 0, 0, 0, 0, $ ftoW, $ ftoH, $ srcW, $ srcH);} if (function_exists ('imagejpeg ') imagejpeg ($ ni, $ toFile); else ImagePNG ($ ni, $ toFile ); imageDestroy ($ ni);} else {ImageDestroy ($ im); return false;} ImageDestroy ($ im); return true ;} // remove the string space static function strTrim ($ str) {return preg_replace ("/\ s/", "", $ str );} // verify the userName static function userName ($ str, $ type, $ len) {$ str = self: strTrim ($ str); if ($ len = $ Min & strlen ($ str) <= $ max) {return true;} else {return false ;}// verify Emailstatic function Email ($ 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 ;}// verify your ID card (China) static function idCard ($ str) {$ str = self: strTrim ($ str ); if (preg_match ("/^ ([0-9] {15} | [0-9] {17} [0-9a-z]) $/I", $ str )) {return true;} else {return false ;}// verify the landline Phone static function Phone ($ type, $ str) {$ str = self: strTrim ($ str ); switch ($ type) {case "CHN": if (preg_match ("/^ ([0-9] {3} | 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] {} $/", $ str) {return true;} else {return false;} break ;}} /*** filter the values of two-dimensional arrays * @ param two-dimensional array $ arr_data * @ param one-dimensional array $ field * @ return Ambigous */Function getarrayfield ($ arr_data, $ field) {$ resultArr = array (); foreach ($ arr_data as $ key => $ value) {foreach ($ field as $ k =>$ v) {if (array_key_exists ($ v, $ value )) // Add {$ resultArr [$ key] [$ v] = $ value [$ v];} else {$ resultArr [$ key] [$ v] = "This column does not exist" ;}} return $ resultArr ;} /*** obtain the Client ip Address * @ return ip */function 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"), "unknown ")) $ ip = getenv ("HTTP_X_FORWARDED_FOR"); else if (getenv ("REMOTE_ADDR") & strcasecmp (getenv ("REMOTE_ADDR"), "unknown ")) $ ip = getenv ("REMOTE_ADDR"); else if (isset ($ _ SERVER ['remote _ ADDR ']) & $ _ SERVER ['remote _ ADDR '] & strcasecmp ($ _ SERVER ['remote _ ADDR'], "unknown") $ ip = $ _ SERVER ['Remote _ ADDR ']; else $ ip = "unknown"; return ($ ip);} function get_http_user_agent () {return isset ($ _ SERVER ['HTTP _ USER_AGENT '])? $ _ SERVER ['HTTP _ USER_AGENT ']: "";}/*** obtain the real address from the IP address * @ param ip $ ip */function 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); return $ data-> product-> location;}/*** generates a random string, it can be used to automatically generate a password. The default length is 6 characters, and the combination of letters and numbers * @ param string $ len Length * @ param string $ type. The string type is * 0 letters, 1 digits, 2 uppercase letters, 3 lowercase letters. Default Value: mix 4 Chinese characters * @ param string $ addChars extra character * @ return string */function rand_string ($ len = 6, $ type = '', $ addChars ='') {$ str = ''; switch ($ type) {case 0: $ chars = 'abcdefghijklmnopqrstuvwxyzabcdefghijklmno Pqrstuvwxyz '. $ addChars; break; case 1: $ chars = str_repeat ('000000', 3); break; case 2: $ chars = 'abcdefghijklmnopqrstuvwxy '. $ addChars; break; case 3: $ chars = 'abcdefghijklmnopqrstuvwxy '. $ addChars; break; case 4: $ chars = "when I come to him, I want to work in China. First, I want to work in order to become a citizen, so that I can come out and learn from others. the lower-level sub-accounts use their peers to say that they have lived a great deal of life, and after the sub-accounts are added to the social media and small hosts, they are also powered by the power line, the high volume of electricity, the Party has to set the depth of the law to form the water physical competition starting from politics, 3, 3, and 10, without agricultural servers, and other anti-body and fighting routes map the things that are being discussed in the beginning from when two or more tianzi event teams approve and emphasize their thoughts and internal reasons parts of the day phase by the pressure officer gas industry on behalf of the whole group number of fruit phase flat each base or month Mao ran if the shape of the mind-like dry are changed to ask more than exhibition that it did not look at the most out Zhiti five solution series linders rice group head meaning only four horses recognize the article pass but more grams and the Public hole leading to access the seat situation runner and fly crude oil put question Quality refers to the establishment of regional validation the masses are very determined. Here, Shi Qiang is very rare and has gone through a total of direct mission to create another cut nine. You take the west to hold the total materials for re-election, and check the tune of the seven mountains Cheng baibao. the Commission's hand-to-hand Management Office has already completed the inspection and recognition of the disease as several first old-light experts and 6 models with the instructions of the Fu 'an belt. After each increase in the East, the wind will return to the south-guang Lao Lun kebei to build a car for the festival. full-link step type set no. column temperature installation that is, the fine axis research monochrome, Fast Anti-stall Shi Lashi set dalon field weaving calendar flower by seeking to pass the mouth breaking condition mining fine gold industry product determination parameter layer end side clear ten indeed, the book-writing factory must be away from the eyes of the sea and the children of the qingcai certificate lower beyond the eight trial rules near the note to run the bumen iron need to go to the county soldiers fixed removal like tooth Qian Sheng Thin Film Ji bai gexiao push blank configuration knife leaf rate description today selected yangde phone query difference half enemy starting film Shi Xiang received wasu standby name red continued average drug mark difficult to store tester body tight liquid accurate Jin angle Dimension Reduction plate Xu broken technology elimination Bottom Bed field Snoop sense to Shen benhe village structure photo volume not engaged in sub-grinding fire section calculation according to the value of the United States Huang yibiao service early shift Mai cut the noise of the letter, Zhang miwei, Hou Cao, He shufa, followed by the city's strict diameter screw detection on the Left page, anti-su xianjiu, Ying, said bad migration, BA Cai, Wu Pei how can he zhijing zhushengwang's eyes be planted? She caught the sub-Miscellaneous containing seedlings and talked about the sources of food and injection. Foot short draw Agent Xuan ring fall first ruler wave Bearing Powder practice House fish with test engraved rely on full husband loss bag to promote branch board bacteria rod week Yan instructor Qu chunyuan ultra negative sand seal taimo poor reduction yangyang river analysis Mu muyan ball Chao Medical School Ancient Rice song listen only transmission slippery station another Wei word drum just write Liu weilu fan for a piece of a Power Set friends limited items over volume creation law rain let the bone far help the initial skin play excellent occupy the dead poison circle Wei Season Training Control exciting look called cloud mutual split grain mother train plug steel top strategy double stay mistaken Foundation suck Resistance therefore, inch shield late silk female scattered welding power plants were cold and wrong, scattered, visual art destroyed version, strong, room, light, blood, times, lack of pump, inspection, rich city, Chong, spray, soil, Jane, no column, Li Wang disk magnetic Xiong seems to be sleepy Yi Zhou take delivery slaves side Run cover swing from touch xingsong get Xingyi official mixing Ji according to not burst frame Wide winter seal wet partial grain eat hold valve mine village responsibility mature stable wins hard price nu flipped Qijia pre-job evaluation read back co-loss cotton invasion gray although the spear thick Luo mud open report box ops oxygen love stop once dissolved camp final gang Meng money to be done russia's sand shrinking, Chen zhengfen, machinery carrying, young, stripping, force rotation, troughs, hold, and drill, weak feet, fear of salt, Yin, Feng, fog, crown, C Street laibei spoke sausage Fu Ji Xi Rui stunned seconds suspension M rotten senson sugar Sheng concave pottery word late silkworm hundred million moment Kang zumu by the garden cavity ordered xiangdi house Minhui forgot to print bees quick Bi expansion injury flying dew core edge game vibration operation Central Wu domain very Xunhui different sequence free paper night township long Lili cylinder folder Nian LAN Ying Gou Yi Ru kill steam phosphorus Jing plug love Huan Iron add bud yongwa tilting Array Carbon play Wei attachment tooth bud yongwa oblique Irrigation ou Xian shun pig foreign rot please pass the division of dangerous pulse should laugh if the tail bunch of strong and violent enterprises food Sui Chu Han more green drag cattle copy dyeing both autumn round forging Yu Xia treatment tip colony well fee state visits blow Rong copper along the rolling passenger call drought Wu thorn brain visit Tibet dare to make Gap shell sulfur coal yingzhu stick probe thin ten good fortune longitudinal selection ceremony may Fu residual mine Yan smoke sentence pure gradual cultivation run ze slow planting Lu chifan environment tide off cone Xi Chi defeat ship fake Bright said to the gang Zhe Huai cut tribute Jin Yi Shen refining Ma sin ancestor interest car wear goods sales Qi rat pumping painting feeding dragon library guard building room Song Han Xi brother wash eclipse waste na belly almost recording mirror women evil fat village wipe insurance likes Bell shake Code handle debate Zhu Gu sell chaos the owner of the virtual bridge rushed to the road, the amount of the wall network cut off the field, and the quiet plot to get the class town, the sub-sheng, the aid, the key, the celebration together around the moo Busy dance, met the Suo Gu, goat, lake, dingrenyin trace broken stretch lamp to avoid Pan death answer Yong frequency Huang Liu ha uncover Gan Nuo summary Xian concentrated island attack who Hong Xie gun pouring spot news understand spirit egg close the Child milk giant man private silver Yijing tanlaiyun mould dulle Bending Performance recruitment Shao Hu call pain peak 0 Chai spring Wu jump jushang Ding Qin slightly chasing Liang discount alkali shugang dig blade drama hehe chest Heng Qin film article in the case of the journal seedling slow convex active cut Sichuan snow chain fish face households Luo sporo Bo Meng buy Yang zongjiao saqi filter silicon carbon shares sitting Steam Condensate actually trapped gun Li rescue hidden holes criminal Tube you song arc burst, fake taste, Jin arm barrier, brown land, Jian Zun, bean pulling, Mo, sang Po, sewing, police pick, dirty ice, Cambodia, Mouth, food, plastic, send Zhao shout, cushion, Dan du ear, planing, Tiger, pen, thin kunlangsa tea drops showner points covered by lenniang tons of Tea sleeves beaded female Mazi opera Tower Hammer Zhen-old appearance clean Section Prison Feng suspected Ba flash Po Meng v. Brush malicious and disaster-caused Joe Tang leakage smell Shen Rong chlorine waste stems man who snatched like pulp side Bo also loyal sing Meng Yu catch the lock, especially by Wu Zhi Dan Yun rebellion animal capture touch rust sweep bibao core ye Jian secret Jing Jiang calcium shoulder Teng dry throwing rail Hall mix dad follow the temptation to wish liken wine rope poor tang dry Bubble bag long feed aluminum soft canal used trade dung integrated wall tends to be another ink congestion Qi reverse unload clothing Sun Ling lie Hugh borrow ". $ addChars; break; case 5: $ chars = 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789 '. $ addChars; break; default: // the confusing oOLl and number 01 are removed by default. To add the parameter $ chars = 'signature', use addChars '. $ addChars; break;} if ($ len> 10) {// the string is too long to repeat for a certain number of times. $ chars = $ type = 1? Str_repeat ($ chars, $ len): str_repeat ($ chars, 5);} if ($ type = 4) {// process Chinese $ chars = preg_replace ('/[^ \ x {4e00}-\ x {9fa5}]/U', '', $ chars ); //// cancel the non-utf8 Chinese Character $ chars = chunk_split ($ chars, 3, ","); /// insert a ",", convert to an array. Use strlen () to test that a Chinese character occupies 3 $ re = explode (",", $ chars); shuffle ($ re ); // random re-order array $ 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 ;}// obtain the value of the parameter in the url function 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 as $ param) {$ item = explode ('=', $ param); $ params [$ item [0] = $ item [1];} return $ params ;} /***** capture remote images ** @ param stri Ng $ url remote image path * @ param string $ filename local storage file name */function grabImage ($ url, $ savepath) {if ($ url = "") {return false; // If $ url is null, false is returned.} $ ext_name = strrchr ($ url ,'. '); // obtain the image extension if ($ ext_name! = '.Gif '& $ ext_name! = '.Jpg '& $ ext_name! = '.Bmp '& $ ext_name! = '.Png ') {return false; // The format is not in the permitted range} // obtain the source image name $ filename = $ savepath.' \ '. end (explode (' http://www.jb51.net/ ', $ Url); // start to capture 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 'image download failed';} fclose ($ local_file); return $ filename ;}}?>

The above Code uses php code to implement all the content of the form data verification class. I hope you will like it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.