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