我正在为我的移动网络应用程序使用Zend Framework 1.11.3和Jquery 1.3.0 beta。我已经参考“http://juriansluiman.nl/en/article/111/mobile-detection-with-zend_http_useragent”来检查用户代理是否是移动的并使用以下代码:
$frontController = Zend_Controller_Front::getInstance();
$bootstrap = $frontController->getParam('bootstrap');
if (!$bootstrap->hasResource('useragent')) {
throw new Zend_Controller_Exception('The mobile plugin can only be loaded when the UserAgent resource is bootstrapped');
}
$userAgent = $bootstrap->getResource('useragent');
if ($userAgent->getBrowserType() === 'mobile') {
echo "mobile";
}
else
{
echo "others";
}
我收到以下警告:“PHP警告:include_once():无法打开'Zend / Http / UserAgent / Device / Features / Browscap.php'(include_path ='/ ... / application / .. /library:/.../library:.:/usr/share/php:/usr/share/pear')/.../library/Zend/Loader.php“。 但是,如果我刷新页面警告消失。 任何帮助将不胜感激。谢谢。