【发布时间】:2013-02-11 08:51:13
【问题描述】:
您好,我尝试将移动模板添加到当前的 zend 应用程序中,但它返回服务器错误。 以下是我在几个网站上关注的配置。
application.in
resources.frontController.plugins[] = "Rate_Application_Mobile"
resources.useragent.wurflapi.wurfl_api_version = "1.1"
resources.useragent.wurflapi.wurfl_lib_dir = APPLICATION_PATH "/../library/wurfl/WURFL/"
resources.useragent.wurflapi.wurfl_config_file = APPLICATION_PATH "/configs/wurfl-config.php"
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;
移动插件 /var/www/library/Rate/Application/Mobile.php
class Rate_Application_Mobile extends Zend_Controller_Plugin_Abstract
{
public function dispatchLoopStartup(Zend_Controller_Request_Abstract $req)
{
$front = Zend_Controller_Front::getInstance();
$bootstrap = $front->getParam("bootstrap");
$userAgent = $bootstrap->getResource('useragent');
$device = $userAgent->getDevice(); --> this part return server error when switching to mobile browser, otherwise it return desktop when view as desktop browser
}
}
谢谢!!
更新:错误返回如下
Warning: include(/var/www/library/wurfl/WURFL/Storage/.php): failed to open stream: No such file or directory in /var/www/library/wurfl/WURFL/ClassLoader.php on line 42
Warning: include(): Failed opening '/var/www/library/wurfl/WURFL/Storage/.php' for inclusion (include_path='/var/www/application/../library:/var/www/library:.:/usr/share/php:/usr/local/Zend/library') in /var/www/library/wurfl/WURFL/ClassLoader.php on line 42
Fatal error: Class 'WURFL_Storage_' not found in /var/www/library/wurfl/WURFL/Storage/Factory.php on line 43
【问题讨论】:
-
究竟是什么错误?
-
它返回服务器错误
-
是的,我确实明白这一点,但它是否返回文字
server error字符串或更多内容?没有消息,代码,什么?也许脚本顶部的一些error_reporting(E_ALL | E_STRICT);会有所帮助? -
嗨,上面是它返回的错误,我不知道这意味着什么,因为所有文件都在正确的位置..
-
这是 PHP 错误,说明找不到类文件。您包含空名称 PHP 文件,因此 WURFL 可能无法检测到它需要加载的内容。请在
ClassLoader.php:42(第一个错误)中的错误行之前执行debug_backtrace(),并检查它尝试/需要在Factory.php:43中加载哪些存储。如果是这个文件:github.com/knnktr-labs/wurfl/blob/master/WURFL/Storage/… 你正在尝试加载一个file提供程序,它应该在你提供的provider配置树中指定,但它没有被读取。
标签: php zend-framework user-agent wurfl