PHP - Á¤±Ô½ÄÀ» ÀÌ¿ëÇÑ IPÁÖ¼Ò À¯È¿¼º üũ |
|
|
![](icon/private_name/1.gif) |
13³â Àü |
PHP - Á¤±Ô½ÄÀ» ÀÌ¿ëÇÑ IPÁÖ¼Ò À¯È¿¼º üũ
¾ÆÀÌÇÇ ÁÖ¼Ò°¡ Çü½Ä¿¡ ¸Â³ª üũÇÏ´Â ÇÔ¼ö·Î ÂüÀ̸é 1À» °ÅÁþÀ̸é 0À» ¹ÝȯÇÕ´Ï´Ù.
<?php
$ipCheck = checkIPAddr("192.168.0.1");
echo$ipCheck;
function checkIPAddr($ip){
$result = 0;
if (preg_match('/^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:[.](?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$/',$ip)){
$result = 1;
}
return $result;
}
?>
|
|
̵̧ : 294 |
̵̧
¸ñ·Ï
|
|