2

在说它是重复的之前,请继续阅读,我已经正确完成了我的作业:) 我检查了其他帖子,但没有任何帮助:(


以下是我已经处理的事情:

1.http://tempdownloads.browserscap.com/下载php_browscap.ini 的更新副本 (当然使用了“仅与 PHP 一起使用”版本)2.尝试了 php_browscap.ini、lite_php_browscap.ini 和 full_php_browscap.ini 3.编辑了php.ini 文件到

[browscap]
;http://php.net/browscap
browscap = "C:\xampp\php\extras\full_php_browscap.ini"

4.通过检查php_info()确认我已经更改了正确的 php.ini 文件

5.是的,删除了那个从';browscap = .....'

6.重述xampp服务器

7.尝试使用“进程监视器” 检查任何文件访问错误https://www.dropbox.com/s/loi8p0fkykzcndr/process_monitor.png

但仍然得到奇怪的值

Array ( [browser_name_regex] => §^.*$§ [browser_name_pattern] => * [comment] => Default Browser [browser] => Default Browser [version] => 0.0 [majorver] => 0 [minorver] => 0 [platform] => unknown [platform_version] => unknown [platform_description] => unknown [alpha] => [beta] => [win16] => [win32] => [win64] => [frames] => [iframes] => [tables] => [cookies] => [backgroundsounds] => [javascript] => [vbscript] => [javaapplets] => [activexcontrols] => [ismobiledevice] => [issyndicationreader] => [crawler] => [cssversion] => 0 [aolversion] => 0 [device_name] => unknown [device_maker] => unknown [renderingengine_name] => unknown [renderingengine_version] => unknown [renderingengine_description] => unknown ) 

请帮助我,我花了很多时间阅读这里发布的答案,试图在谷歌上找到解决方案,看过 NewBoston 的视频

4

1 回答 1

0
// Loads the class
require 'path/to/Browscap.php';
// Creates a new Browscap object (loads or creates the cache)
$bc = new Browscap('path/to/the/cache/dir');
// Gets information about the current browser's user agent
$current_browser = $bc->getBrowser();    
// Output the result
echo '<pre>'; // some formatting issues ;)
print_r($current_browser);

我们将省略注释“输出结果”下的最后一部分,因此您的代码应如下所示……</p>

 // Loads the class
require 'path/to/Browscap.php';
 // Creates a new Browscap object (loads or creates the cache)
  $bc = new Browscap('path/to/the/cache/dir');
 // Gets information about the current browser's user agent
 $current_browser = $bc->getBrowser();
于 2013-12-19T12:31:32.707 回答