我正在关注使用 Zend Framework 设置 WURFL 的教程,以实现轻松的移动浏览器检测。
http://framework.zend.com/manual/en/zend.http.user-agent.html#zend.http.user-agent.quick-start
我已经将它设置到可以检测桌面浏览器并为我提供该浏览器的所有详细信息和功能的地步,但是当我尝试使用 iPhone(移动 safari)访问该网站时,它会在尝试编写时引发错误到缓存目录。
这是我在错误日志中看到的内容:
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/configs/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 观察我的缓存目录设置?
注:本教程以 wurfl-1.1 为例,我只能在 sourceforge 上找到 wurfl-1.3。这可能是一个问题。
注意:我的 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"