1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <?php namespace Home\Controller; use Think\Controller; class CommonController extends Controller { public $user; public function _initialize(){ if (!$user = $this->checkSession()) { $action = strtolower(ACTION_NAME); if (!in_array($action, array('login', 'checklogin'))) { redirect('/User/Login/'); } } $this->user = $user; } function checkSession() { return isset($_SESSION['user']) ? $_SESSION['user']:false; } } |
ThinkPHP判断会员登录控制器
0