Cakephpdocs 42

CategoryCakePHP functions - beforeFilter() - a controller function
Code ExamplesThe beforeFilter() callback action is called before every action is executed. It is entered like any other action, as a PHP function, and interrupts processing controller logic in the requested action. To block users from accessing a certain area of the site, the beforeFilter() action can check the session for information. Example: function beforeFilter() { if ($this->action == 'view') { if (!$this->Session->check('User')) { $this->redirect('/users/login'); } } }
Test Code
Links
Remarks
Cancel