controllers/app_controller.php
<?php ... function checkSession() { if (!$this->Session->check("User")) { $this->redirect("/login/index"); exit(); } }
各コントローラ内
<?php ... /** * セッションが切れたらログインフォームへ飛ばす * @see app_controller.php */ function beforeFilter() { $this->checkSession(); }