下面是关于使用设置WURFL的教程,以便于移动浏览器的检测。
http://framework.zend.com/manual/en/zend.http.user-agent.html#zend.http.user-agent.quick-start
我已经将其设置到可以检测到桌面浏览器并向我提供该浏览器的所有细节和特性的程度,但当我试图使用iPhone (移动狩猎)访问网站时,它会在试图写入缓存目录时抛出一个错误。
下面是我在错误日志中看到的内容:
2011-06-08T22:32:34-07:00 ERR (3): The file cache directory does not exist and could not be created. Please make sure the cache directory is writeable: /var/tmp但是,在我在/application/ to /wurfl-config.php的配置中,我将缓存目录设置为:
<?php
$resourcesDir = dirname(__FILE__) . '/../../data/wurfl/';
$wurfl['main-file'] = $resourcesDir . 'wurfl-2.0.27.zip';
$wurfl['patches'] = array($resourcesDir . 'web_browsers_patch.xml');
$persistence['provider'] = 'file';
$persistence['dir'] = $resourcesDir . '/cache/';
$cache['provider'] = null;
$configuration['wurfl'] = $wurfl;
$configuration['persistence'] = $persistence;
$configuration['cache'] = $cache;我还确保了服务器可以写它,但是wurfl似乎认为我的缓存目录仍然是/var/tmp
如何让wurfl观察我的缓存目录设置?
Notes:本教程使用wurfl-1.1作为示例,我只能在sourceforge上找到wurfl-1.3。这可能是个问题。
Notes:我的application.ini文件中有以下几行:
; WURFL
resources.useragent.wurflapi.wurfl_api_version = "1.1"
resources.useragent.wurflapi.wurfl_lib_dir = APPLICATION_PATH "/../library/wurfl-php-1.3.0/WURFL/"
resources.useragent.wurflapi.wurfl_config_file = APPLICATION_PATH "/configs/wurfl-config.php"发布于 2011-06-21 14:10:53
(我刚刚解决了这个问题;)
从下面的代码行中删除[]:
resources.useragent.wurflapi.wurfl_config_array.wurfl.patches[] = APPLICATION_PATH "/../data/wurfl/web_browsers_patch.xml"将其转换为:
resources.useragent.wurflapi.wurfl_config_array.wurfl.patches = APPLICATION_PATH "/../data/wurfl/web_browsers_patch.xml"发布于 2011-06-28 11:30:31
在版本1.3中,参数的格式似乎发生了变化-- WURFL文档这里有详细信息和一个示例文件。
因此,对于最初的问题,$persistence‘’dir‘行需要更改为:
$persistence['params'] = array(
'dir' => $resourcesDir . '/cache/'
);发布于 2011-09-28 10:41:15
我使用Wurfl 1.3.1解决了这个问题,并阅读了以下内容:
http://wurfl.sourceforge.net/nphp/
https://stackoverflow.com/questions/6299986
复制相似问题