Home > Backend Development > PHP Tutorial > php FILTER_VALIDATE_IP_PHP tutorial

php FILTER_VALIDATE_IP_PHP tutorial

WBOY
Release: 2016-07-13 17:07:04
Original
1100 people have browsed it

The filter verifies the IP address to see if it is legal.

Definition and usage
This filter validates the FILTER_VALIDATE_IP value as a URL.

Name: "validate_ip"
ID number: 275
Possible flags:

<?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

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/630488.htmlTechArticleThe filter verifies whether the IP address is legal. Definition and Usage This filter validates the FILTER_VALIDATE_IP value as a URL. Name: validate_ip ID number: 275 Possible flags: ...
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