2009-11-09 4 views
0

Wurfl을 구현했지만이 문제는 내 휴대폰에 잘못된 화면 해상도를 제공한다는 점에서 문제가 있습니다. 얼마나 정확한 wurfl이고 나는 무엇을 잘못하고 있는지 모른다.Wurfl을 사용하여 모바일 화면 해상도를 감지합니까?

require_once 'wurfl_config.php'; 

require_once WURFL_CLASS_FILE; 

$ua = strtolower($_SERVER['HTTP_USER_AGENT']); 


$wurflObj = new wurfl_class(); 
$wurflObj->GetDeviceCapabilitiesFromAgent($ua); 

$width = $wurflObj->capabilities['display']['resolution_width']; 

//Config file 
    // Single define to be checked when starting the parser and/or the class 
define("WURFL_CONFIG", true); 

// Where all data is stored (wurfl.xml, cache file, logs, etc) 
$data = '/var/www/html/includes/wurfl/'; 
define("DATADIR", $data); 

// Path and filename of wurfl_parser.php 
define("WURFL_PARSER_FILE", 'wurfl_parser.php'); 

// Path and filename of wurfl_class.php 
define("WURFL_CLASS_FILE", 'wurfl_class.php'); 

// Path and name of the wurfl 
define ("WURFL_FILE", DATADIR."wurfl.xml"); 

// Path and name of the log file 
define ("WURFL_LOG_FILE", DATADIR."wurfl.log"); 

// suggested log level for normal use (default PHP logging constants) 
//define ("LOG_LEVEL", LOG_ERROR); 
// suggested log level for debug use 
define ("LOG_LEVEL", LOG_INFO); 

// Set this true if you want to use cache. Strongly suggested 
define ("WURFL_USE_CACHE", true); 

// Set this true if you want to avoid using cache.php file, and 
// generate a single file for each device user agent and use that as a cache 
// NOTICE: using Multicache will still generate cache.php and agent2id.php, 
// but will not dump the entire XML as PHP into cache.php. As a result 
// cache.php will be MUCH smaller and load WAY faster; as a drawback you will 
// have many more I/O accesses to the single tiny files. 
define ("WURFL_USE_MULTICACHE", true); 

// Path and name of the cache file 
define ("CACHE_FILE", DATADIR."cache.php"); 

// Set path of the Multicache directory where all the little caches will be 
// stored. Should be a directory that contains *only* these files, so that its 
// content can be safely cleaned when a new cache is created. 
// If not using Multicache, this parameter will not be used. 
define ("MULTICACHE_DIR", DATADIR."multicache/"); 

// Temporary directory for manual updates. 
define ("MULTICACHE_TMP_DIR", DATADIR."multicache_tmp/"); 
// This file is created and removed when manually updating multicache files 
define ("MULTICACHE_TOUCH", DATADIR."multicache.lockfile"); 

// File suffix for Multicache files 
define ("MULTICACHE_SUFFIX",".php"); 

// Autoload set to false, I will load it when needed 
define ("WURFL_AUTOLOAD", false); 

// This parameter tells the class to automatically update cache files when a 
// new XML is found. 
// Using the multicache is not suggested to automatically update it. Use the 
// external scripts. 
define ("WURFL_CACHE_AUTOUPDATE", true); 

// Path and name of the file to store user_agent->id relation 
// (ignored if caching is disabled) 
define ("WURFL_AGENT2ID_FILE", DATADIR."agent2id.php4"); 

// Configure a patch file 
define("WURFL_PATCH_FILE", DATADIR.'wurfl_patch.xml'); 
define("WURFL_PATCH_DEBUG", false); 

//define("WURFL_PATCH_FILE", DATADIR.'web_browsers_patch.xml'); 

// Set the maximum number of user_agents to cache 
define ("MAX_UA_CACHE", 30); 

잘못된 너비가 반환되는 알려진 문제입니까? 아니면 잘못된 것이 있습니까?

+0

이 오류의 예를 들려 줄 수 있습니까? 특정 핸드셋, 예상 한 것을 말하고 실제로 얻은 것을 말하십시오. –

답변

3

WURFL은 데이터만큼 정확합니다. 일반적으로 매우 좋습니다.

어떤 버전의 WURFL 데이터를 사용하고 있습니까?
화면 크기를 가져 오려고하는 기기와 브라우저는 무엇입니까? (사용자 에이전트 란 무엇입니까?)
어떤 가치가 있습니까?
어떤 가치가 있습니까?

+0

안녕 Matt, 걱정 하지마, Wurfl 파일 (2.0.12)을 다시 다운로드했는데 이제는 정확한 화면 해상도를 감지하고 이제는 작동합니다. 아마도 이전 파일에 문제가있을 수 있습니다. – Roland

관련 문제