An example of the URL address verification function in PHP, friends in need can take a look.
The code is as follows
代码如下 |
复制代码 |
// 函数名:CheckWebAddr($C_weburl)
// 作 用:判断是否为有效网址
// 参 数:$C_weburl(待检测的网址)
// 返回值:布尔值
// 备 注:无
//-----------------------------------------------------------------------------------
function CheckWebAddr($C_weburl)
{
if (!ereg("^http://[_a-zA-Z0-9-]+(.[_a-zA-Z0-9-]+)*$", $C_weburl))
{
return false;
}
return true;
}
|
|
Copy code |
|
// Function name: CheckWebAddr($C_weburl)
// Function: Determine whether it is a valid URL
// Parameter: $C_weburl (URL to be detected)
//Return value: Boolean value
// Remarks: None
//--------------------------------------------- ----------------------------------------
function CheckWebAddr($C_weburl)
{
if (!ereg("^http://[_a-zA-Z0-9-]+(.[_a-zA-Z0-9-]+)*$", $C_weburl))
{return false;
}
return true;
}
http://www.bkjia.com/PHPjc/631664.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631664.htmlTechArticleAn example of the url address verification function in php, friends in need can take a look. The code is as follows Copy code // Function name: CheckWebAddr($C_weburl) // Function: Determine whether it is a valid URL...