You can use a link because without form you cannot use button otherwise you have to use ajax
<a href="<?php echo base_url() ?>controller_class_name/logout">Logout</a>
function logout() {
$this->session->sess_destroy();
redirect('controller_class/login');
}