request->cookies; $user_id = $cookies->getValue('user_id'); if(!$user_id){ header("Location: http://". CS_DOMAIN. "/login.html"); //确保重定向后,后续代码不会被执行 exit; } // custom initialization code goes here } }