CodeIgniter偵測使用者瀏覽器

方式一:使用user_agent跟redirect
[php]
$this->load->library(‘user_agent’);
$this->load->helper(‘url’);
if ($this->agent->browser() == ‘Internet Explorer’ and $this->agent->version() <= 7)
redirect(‘/unsupported-browser’);
[/php]

方式二:使用 http://mobiledetect.net
[php]
$this -> load -> library(‘Mobile_Detect’);
$detect = new Mobile_Detect();
if ($detect->is(‘Chrome’) || $detect->is(‘iOS’)) {

}
[/php]