php验证url地址是否正确
php验证url地址是否正确 [代码片段(6行)]
$url = "https://www.sharejs.com"; if (preg_match('/^(http|https|ftp)://([A-Z0-9][A-Z0-9_-]*(?:.[A-Z0-9][A-Z0-9_-]*)+):?(d+)?/?/i', $url)) { echo "Your url is ok."; } else { echo "Wrong url."; }
精彩图集
精彩文章