php url正则匹配

PHP中URL正则匹配代码:

$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";
} 


你可能感兴趣的:(PHP,url,正则,匹配)