Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想限制来自特定地理区域的所有用户访问我的网站。
您可以使用 PHP 来执行此操作:
<?php $ip = $_SERVER['REMOTE_ADDR']; $file = file_get_contents("http://api.hostip.info/?ip={$ip}"); if(stristr($file, 'bad country') === FALSE) { echo 'ya\'ll may visit this here site.'; } else { echo "nope!"; } ?>