URL regular matching code in PHP:
$regex = '/^(http|https|ftp):\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\’:+!]*([^<>\”])*$/'; $url = "http://www.baidu.com"; if (preg_match($regex, $url)) { echo "Ture"; } else { echo "False"; }
Copyright statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.
The above introduces PHP url regular matching, including aspects of content. I hope it will be helpful to friends who are interested in PHP tutorials.