-1

モバイル サイトを作成中で、現在のアプリを変換する作業を開始しています。CodeIgniter の組み込みのユーザー エージェント クラスの使用を検討していますが、次のことが可能かどうかを知りたいです。

$this->load->library('user_agent');

if (!$this->agent->is_mobile()) {
  $this->_showPage("newquote/newquotemobile", 'Test Mobile Page', $viewData);
}
else {
  $this->_showPage("newquote/newquote", 'Test Page', $viewData);
}

CodeIgniter のビルトイン ユーザー エージェント クラスを使用した経験のある人はいますか?

4

1 に答える 1

3

That is pretty much exactly how you want to do it (determine if the user agent is mobile) but I do not see why you chose to negate the condition. I think it the "!" is in there by mistake.

That is how you use the user agent class provided with CI. http://ellislab.com/codeigniter/user-guide/libraries/user_agent.html

于 2013-05-20T15:12:09.380 に答える