モバイル Web アプリケーションに Zend Framework 1.11.3 と Jquery 1.3.0 ベータ版を使用しています。ユーザー エージェントはモバイルであり、次のコードを使用しました。
$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";
}
次の警告が表示されます。 /.../library:.:/usr/share/php:/usr/share/pear') /.../library/Zend/Loader.php". しかし、ページを更新すると、警告が消えます。事前に感謝します。