使用字符串函数 [英] using string functions

查看:88
本文介绍了使用字符串函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用$ ip = $ _SERVER [''REMOTE_ADDR'']检索客户端的IP地址

,例如,如果从$ ip返回的值是

50.160.190.150


i想知道请求来自哪个国家/地区。我相信通过使用

ip地址中的第三组数字(在这种情况下= 190),我们可以找到国家名称。我可以声明一个变量

,其中包含国家名称列表和值范围,我需要帮助

是从$ ip中提取第3组数字。 br />

作为ip地址不断更改第3组数字可以单,

双倍或3位数我们如何提取存储的数字

在第二个点之后和第三个点之前的$ ip


请指教。


谢谢。

i am using $ip= $_SERVER[''REMOTE_ADDR''] to retrieve the ip address of
the client for example if the value returned from $ip is
50.160.190.150

i would like to find out which country the request has come from. i
believe by using the third set of numbers (in this case=190) from an
ip address we can find out the country name. i can declare a variable
with a list of country names and the range of values, what i need help
is to extract the 3rd set of numbers from $ip.

as ip address keep changing the 3rd set of numbers can be single,
double or 3 digit number how can we extract the number that is stored
in $ip after the second dot and before the third dot

please advice.

thanks.

推荐答案

ip =


_SERVER [''REMOTE_ADDR'']来检索
$ b的IP地址$ b客户端,例如,如果从
_SERVER[''REMOTE_ADDR''] to retrieve the ip address of
the client for example if the value returned from


ip返回的值是

50.160.190.150


i想要找出请求来自哪个国家/地区。我相信通过使用

ip地址中的第三组数字(在这种情况下= 190),我们可以找到国家名称。我可以声明一个变量

,其中包含国家名称列表和值范围,我需要帮助

是从
ip is
50.160.190.150

i would like to find out which country the request has come from. i
believe by using the third set of numbers (in this case=190) from an
ip address we can find out the country name. i can declare a variable
with a list of country names and the range of values, what i need help
is to extract the 3rd set of numbers from

中提取第3组数字


这篇关于使用字符串函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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