按IP显示国家/地区标志 [英] Display Country Flag by IP

查看:151
本文介绍了按IP显示国家/地区标志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够通过IP显示国家标志图像。 IP以列的形式存储在Mysql中,每个页面都有自己的IP行,如下所示:

I want to be able to display the Country Flag image by the IP. The IPs are stored in Mysql in a column, each page has it's own row with IP like so:

TABLE:
PAGEID    INFO    IP
12340     abc     120.120.120.120
12341     fgh     121.121.121.121
12342     ert     122.122.122.122
12343     bvn     120.120.120.120  
12344     hjk     123.123.123.123

因此当用户打开它时,将通过mysql的页面ID获取IP,然后决定哪个国家/地区标志基于IP显示。

除了下面的那个之外还有这样的脚本吗?

So when a user open it will get the IP by the page id from mysql and then decide what country flag to display based on the IP.
Is there such a script like this besides the one below?

这是我发现的一个类似的脚本但它是不工作:

This is a similar script i found but it's not working:

<IMG SRC="http://api.hostip.info/flag.php?ip=12.215.42.19">
<IMG SRC="http://api.hostip.info/flag.php?ip=<YOUR IP HERE>">


推荐答案

参考这篇文章,使用switch case或if else回应你的旗帜
教程

refer to this article ,use switch case or if else to echo your flag tutorial

这篇关于按IP显示国家/地区标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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