PHP detects URL address validity
The code is as follows
function is_url($str){
return preg_match("/^http://[A-Za-z0-9] .[A-Za-z0-9] [/=?%-&_~`@[]': !]*([^< ;>"])*$/", $str);
}
?>
If you want to try if it works normally, we can use the file_get_contents() function to verify it.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn