Home > Backend Development > PHP Tutorial > URL address legality detection function in php_PHP tutorial

URL address legality detection function in php_PHP tutorial

WBOY
Release: 2016-07-13 16:55:49
Original
863 people have browsed it

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

//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...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template