时间:2021-07-01 10:21:17 帮助过:19人阅读
首先写个函数
function varify_url($url){
$check = @fopen($url,"r");
if($check){
$status = true;
}else{
$status = false;
}
return $status;
}
接着在需要的地方直接调用即可
$url = "http://www.baidu.com";
if(varify_url($url)){
echo "Congratulation ! Your URL $url : is valid ";
}else{
echo "Error ! Your URL : $url is invalid ";
}
希望本文所述对大家的php程序设计有所帮助。