Php 如何在WordPress中获取当前访客国家时区

Php 如何在WordPress中获取当前访客国家时区,php,wordpress,Php,Wordpress,我目前正在使用geoplugin 函数getusercountrycode() { $ip=$\u服务器['REMOTE\u ADDR']; $ch=curl_init(); $curlConfig=array( CURLOPT_URL=>”http://www.geoplugin.net/json.gp? ip=“.$ip, CURLOPT_POST=>true, CURLOPT_RETURNTRANSFER=>true, CURLOPT_POSTFIELDS=>false ); curl

我目前正在使用
geoplugin

函数getusercountrycode() { $ip=$\u服务器['REMOTE\u ADDR']; $ch=curl_init(); $curlConfig=array( CURLOPT_URL=>”http://www.geoplugin.net/json.gp? ip=“.$ip, CURLOPT_POST=>true, CURLOPT_RETURNTRANSFER=>true, CURLOPT_POSTFIELDS=>false ); curl_setopt_数组($ch,$curlConfig); $result=curl\u exec($ch); 卷曲关闭($ch); $json_a=json_decode($result,true); $countrycode=$json_a['geoplugin_countrycode']; 返回$countrycode;
}geoplugin_时区从这里获取$timezone=$json_a['geoplugin_timezone'];好的,让我检查一下并回复你@technodevisures,它正在工作,谢谢
geoplugin_timezone get from here

$timezone= $json_a['geoplugin_timezone '];