Home > php教程 > php手册 > php FILTER_VALIDATE_IP

php FILTER_VALIDATE_IP

WBOY
Release: 2016-06-13 10:09:32
Original
1095 people have browsed it

过滤器验证ip地址,是否合法。

定义和用法
该过滤器验证FILTER_VALIDATE_IP价值作为一个网址。

名称: “ validate_ip ”
身份证号码: 275
可能的旗帜:

<?php $ip = "192.168.0.1";
Copy after login
if(!filter_var($ip, FILTER_VALIDATE_IP))
 {
 echo "IP is not valid";
 }
else
 {
 echo "IP is valid";
 }
?>
Copy after login
输出结果。
Copy after login
is is valid
Copy after login
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