Tera-WURFL:未定义的索引ID

时间:2011-07-27 15:29:46

标签: php wurfl

我收到此错误:Undefined index: id [/Applications/XAMPP/xamppfiles/htdocs/tera-wurfl/TeraWurfl.php, line 297]

执行此功能:

public static function getTeraWurflData() {
         $capabilities = array(
             'brand_name',
             'model_name',  
             'is_wireless_device',           
         );                 

         $ua = WurflSupport::getUserAgent(); 
         $wurflObj = new TeraWurfl();    
         $matched = false;  
         $matched = $wurflObj->getDeviceCapabilitiesFromAgent($ua, true);
         $deviceCapabilities = array();  
         foreach ($capabilities as $capability) {
             $deviceCapabilities[$capability] = $wurflObj->getDeviceCapability($capability);
         }

         $deviceCapabilities['user_agent'] = $ua;

         if ($_SERVER)      
         {
             $ip = $_SERVER["REMOTE_ADDR"];  
         }
         else
         {
             if ( getenv( "HTTP_X_FORWARDED_FOR" ) )
                 $ip = getenv( "HTTP_X_FORWARDED_FOR" );
             else
                 if ( getenv( "HTTP_CLIENT_IP" ) )
                     $ip = getenv("HTTP_CLIENT_IP"); 
                 else
                     $ip = getenv("REMOTE_ADDR");    
         }

         $deviceCapabilities['ip'] = $ip;

         return $deviceCapabilities;     
      }

我的Tera-WURFL配置没有问题,以前有人发生这种情况吗?

1 个答案:

答案 0 :(得分:1)

我找到了解决这个问题的方法,你只需要将你的Tera-WURFL设置为使用MySQL4而不是配置文件中的5,这将使问题消失。 Here是Tera论坛中我的帖子的链接,帮助我解决了问题