PHP code example of mileschou / twnicip

1. Go to this page and download the library: Download mileschou/twnicip library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mileschou / twnicip example snippets


$twnicIp = new TwnicIp();

$twnicIp->isTaiwan('202.39.128.1'); // isTaiwanByIp() 的別名
$twnicIp->isTaiwanByIp('202.39.128.1');
$twnicIp->isTaiwanByLong(3391586305); // 轉成 IP 即 202.39.128.1 

$twnicIp->->isTaiwan('127.0.0.1'); // return true

$twnicIp->excludeRange('127.0.0.1', '127.0.0.1');

$twnicIp->isTaiwan('127.0.0.1'); // return false

$twnicIp->