<?php
/**
* User_agent Class
*
* Created on 2011. 11. 16.
* @author 불의회상 <hoksi2k@hanmail.net>
* @package library
* @subpackage controllers
* @version 1.0
*/
class User_agent_lib extends CI_Controller {
function __construct() {
parent::__construct();
}
function index() {
$this->load->library('user_agent');
if ($this->agent->is_browser()) {
$agent = $this->agent->browser().' '.$this->agent->version();
} elseif ($this->agent->is_robot()) {
$agent = $this->agent->robot();
} elseif ($this->agent->is_mobile()) {
$agent = $this->agent->mobile();
} else {
$agent = 'Unidentified User Agent';
}
$data['agent'] = $agent;
$data['platform'] = $this->agent->platform(); // 플렛폼정보 (Windows, Linux, Mac, etc.)
$this->load->view('user_agent_lib_sample', $data);
}
}
<?php $this->load->view('inc/header')?>
<table class="tablesorter" border="0" cellpadding="0" cellspacing="1">
<thead>
<tr>
<th style="text-align:center" width="20%">구분</th>
<th width="80%">결과</th>
</tr>
</thead>
<tr>
<td>User Agent</td>
<td><?php echo $agent?></td>
</tr>
<tr>
<td>Platform</td>
<td><?php echo $platform?></td>
</tr>
<tr>
<td>$this->agent->referrer()</td>
<td><?php echo $this->agent->referrer()?></td>
</tr>
<tr>
<td>$this->agent->agent_string()</td>
<td><?php echo $this->agent->agent_string()?></td>
</tr>
</table>
<?php $this->load->view('inc/footer')?>
© Copyright by hoksi(Page rendered in 0.0061 seconds)