使用 Zend 实现 WURFL 时出现错误

发布于 2024-10-21 14:31:39 字数 1431 浏览 7 评论 0原文

我环顾四周,似乎找不到与我有同样问题的人,希望我没有错过这里的叮当声。

我想要获取每个用户的设备浏览器信息,我目前计划在引导程序中执行此操作,遵循我在 PHP 会议上看到的内容。

为此,我遇到了:

http://framework.zend。 com/manual/en/zend.http.user-agent.html

其中解释了如何安装和使用 wurfl。我已按照说明进行操作,但出现以下异常:

Uncaught exception 'Zend_Http_UserAgent_Features_Exception' with message '"wurflapi"configuration is not Define'

我对 Zend 的有限理解使我认为问题出在 configs/application.ini

中有以下内容:

resources.useragent.wurflapi.wurfl_api_version  = "1.1"
resources.useragent.wurflapi.wurfl_lib_dir = APPLICATION_PATH "/../library/wurfl-php-1.1/"
resources.useragent.wurflapi.wurfl_config_file = APPLICATION_PATH "/configs/wurfl-config.php"

我的 wurfl-config.php 看起来像:

echo "Loaded";
die;
$resourcesDir            = dirname(__FILE__) . '/../../data/wurlf/';
$wurfl['main-file']      = $resourcesDir  . 'wurfl-latest.zip';
$wurfl['patches']        = array($resourcesDir . 'web_browsers_patch.xml');
$persistence['provider'] = 'file';
$persistence['dir']      = CACHE_ROOT . "/wurfl/";
$cache['provider']       = null;

$configuration['wurfl']       = $wurfl;
$configuration['persistence'] = $persistence;
$configuration['cache']       = $cache;

我希望脚本在加载 priting 后死掉,但我没有得到这个,这意味着配置未正确加载。

问题可能出在哪里?您还需要什么信息?以前有其他人遇到过这种困境吗?

提前致谢

I've looked around and cant seem to find someone with the same issue as me, hoping i've not missed a clanger here.

I'm wanting to get device browser information for each user, i'm currently planning on doing this within the bootstrapper, following something i saw in PHP conference.

To that end i came across:

http://framework.zend.com/manual/en/zend.http.user-agent.html

Which explains how to install and use wurfl. I've followed the instructions and am coming up with the following exception:

Uncaught exception 'Zend_Http_UserAgent_Features_Exception' with message '"wurflapi" configuration is not defined'

My limited understanding of Zend leads me to think the issue is within configs/application.ini

I have the following:

resources.useragent.wurflapi.wurfl_api_version  = "1.1"
resources.useragent.wurflapi.wurfl_lib_dir = APPLICATION_PATH "/../library/wurfl-php-1.1/"
resources.useragent.wurflapi.wurfl_config_file = APPLICATION_PATH "/configs/wurfl-config.php"

Where my wurfl-config.php looks like:

echo "Loaded";
die;
$resourcesDir            = dirname(__FILE__) . '/../../data/wurlf/';
$wurfl['main-file']      = $resourcesDir  . 'wurfl-latest.zip';
$wurfl['patches']        = array($resourcesDir . 'web_browsers_patch.xml');
$persistence['provider'] = 'file';
$persistence['dir']      = CACHE_ROOT . "/wurfl/";
$cache['provider']       = null;

$configuration['wurfl']       = $wurfl;
$configuration['persistence'] = $persistence;
$configuration['cache']       = $cache;

I'm expecting the script to die after priting loaded, but i'm not getting this, meaning the config isnt loading correctly.

Where might be the problem? What more information do you require? Has anyone else come across this dilemma before?

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

作业与我同在 2024-10-28 14:31:39

看来你无法做到我想要的。

因为这似乎不想在引导程序中工作。相反,您应该将其作为插件来执行。

该视频教程有助于更好地解释文档:

http://mcloide.wordpress.com/2010/12/08/mobile-development-with-zend-framework-and-wurfl/

现在我已经设置了插件,我没有得到异常我的配置加载完美。哼!!

Seems that you're unable to do what i want.

In that this doesnt seem to want to work within a bootstrap. Instead you should do this as a plugin.

This video tutorial helps explain the documentation a little better:

http://mcloide.wordpress.com/2010/12/08/mobile-development-with-zend-framework-and-wurfl/

Now that i have setup the plugin i dont get the exception and my config loads perfectly. Humpf!!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文