![](/img/trans.png)
[英]how to check if user comes from facebook browser with PHP/Laravel
[英]How to know if a browser user is from Switzerland in PHP?
有没有一种方法可以确定用户是否将其语言环境设置为瑞士? 我试过了
$_SERVER['HTTP_ACCEPT_LANGUAGE']
但这只是给我“ de”作为语言环境。 还有另一种方法,或者我做错了什么? 可能有免费的IP检查服务吗?
您可以使用此 php类来获取用户在php中的位置。
获得文件后,可以使用以下代码:
<?php
/*
* Website http://www.codehelper.io
* Author: khoaofgod@yahoo.com
* Any bugs, question, please visit our forum at http://www.codehelper.io
*/
// Required Libraries
require_once("ip.codehelper.io.php");
require_once("php_fast_cache.php");
// New Class
$_ip = new ip_codehelper();
// Detect Real IP Address & Location
$real_client_ip_address = $_ip->getRealIP();
$visitor_location = $_ip->getLocation($real_client_ip_address);
// Output result
echo $visitor_location['Country']."<br>";
echo "<pre>";
print_r($visitor_location);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.