如何限制哪些国家可以查看我的网站(PHP) [英] How do I limit which countries can view my website ( PHP )

查看:85
本文介绍了如何限制哪些国家可以查看我的网站(PHP)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在PHP中有一个简单的方法来做到这一点。我想确保只有来自某些国家的网络请求才能访问我的网站。



有什么想法?



http://www.maxmind.com/app/geolitecity 是免费的(不太准确)的商业版本。

In there an easy way to do this in PHP. I want to make sure that only web requests from certain countries are able to access my website.

Any ideas?

解决方案

Use an IP geolocation database (some are free) and $_SERVER["REMOTE_ADDR"] to get the visitor's IP address.

http://www.maxmind.com/app/geolitecity is a free (less accurate) version of a commercial one.

这篇关于如何限制哪些国家可以查看我的网站(PHP)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆