Home > php教程 > php手册 > body text

php中url地址合法性检测函数

WBOY
Release: 2016-05-25 16:56:22
Original
1351 people have browsed it
一个实例的php中url地址验证函数,有需要的朋友可以看看。
 代码如下 复制代码

// 函数名: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;

}



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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template