PHP presets the http string function code for the URL address obtained from the form. Copy the code as follows: if (! Preg_match (^ (http | ftp):, $ _ POST [url]) {$ _ POST [url]. $ _ POST [url];} the code first uses regular expressions to check whether the string contains
The code is as follows:
If (! Preg_match ("/^ (http | ftp):/", $ _ POST ['URL']) {
$ _ POST ['URL'] = 'http: // '. $ _ POST ['URL'];
}
This code first uses a regular expression to check whether the string contains "http", "ftp", and "colon": ". if not, add" http: // "before the string ://"
The http://www.bkjia.com/PHPjc/321864.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/321864.htmlTechArticle code is as follows: if (! Preg_match ("/^ (http | ftp):/", $ _ POST ['URL']) {$ _ POST ['URL'] = 'http: //'. $ _ POST ['URL'];} this code first uses a regular expression to check whether the string contains "...