Display Country Flag by IP

时光总嘲笑我的痴心妄想 提交于 2019-12-24 11:37:47

问题


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

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>">

回答1:


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



来源:https://stackoverflow.com/questions/13409944/display-country-flag-by-ip

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!