CodeIgniter authenticate the user in every Controller
问题 I'm building my first project in Codeigniter, using Tank_auth to handle my CMS authentication. It's working ok but I have a question about best practices. Currently, every function in every controller has the following structure: public function add() { if ($this->tank_auth->is_logged_in()) { $data['stuff'] = 'stuff'; $this->load->view('admin/cms_add',$data); } else { redirect('/admin/login/'); } } With quite a few controllers, and a few functions in each, it's starting to get repetitive, and