Home  >  Article  >  Backend Development  >  php FILTER_VALIDATE_IP_PHP tutorial

php FILTER_VALIDATE_IP_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:07:041020browse

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

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: ...
Statement:
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