php 如何使 geoip_country_name_by_name() 工作?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10821974/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-24 23:07:32  来源:igfitidea点击:

How to make geoip_country_name_by_name() work?

phpgeoip

提问by Micku

I want to collect country name of an user who logined to my site. So i used

我想收集登录我网站的用户的国家/地区名称。所以我用

geoip_country_name_by_name()php function for this purpose.

geoip_country_name_by_name()php 函数用于此目的。

But i got a fatal error as :

但我得到了一个致命的错误:

Fatal error: Call to undefined function geoip_country_name_by_name()

How can i avoid this error ?

我怎样才能避免这个错误?

Is there any other method to get country name using php?

有没有其他方法可以使用php获取国名?

Can someone help me please?

有人能帮助我吗?

采纳答案by baptme

you need the PECL extension, have a look here http://www.php.net/manual/en/geoip.installation.php

你需要 PECL 扩展,看看这里http://www.php.net/manual/en/geoip.installation.php

回答by David

Sounds like the extension is not installed on your computer. Check out this link, it is a PECL extension.

听起来您的计算机上未安装该扩展程序。查看此链接,它是 PECL 扩展。

http://www.php.net/manual/en/geoip.setup.php

http://www.php.net/manual/en/geoip.setup.php