当前位置: 首页>>代码示例>>PHP>>正文


PHP Engine::clearSession方法代码示例

本文整理汇总了PHP中Engine::clearSession方法的典型用法代码示例。如果您正苦于以下问题:PHP Engine::clearSession方法的具体用法?PHP Engine::clearSession怎么用?PHP Engine::clearSession使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Engine的用法示例。


在下文中一共展示了Engine::clearSession方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: authenticate

 private function authenticate()
 {
     //Try gaining access to the Facebook PHP SDK
     try {
         $accessToken = SDK::instance()->helper->getAccessToken();
     } catch (Facebook\Exceptions\FacebookResponseException $e) {
         throw new Exception("Graph returned an error: " . $e->getMessage());
     } catch (Facebok\Exceptions\FacebookSDKException $e) {
         throw new Exception("Facebook SDK returned an error: " . $e->getMessage());
     }
     //Assuming it went well, let's process our login state
     if (!is_null($this->getToken()) || isset($accessToken)) {
         //This if statements means that it doesn't matter if the session token is set or not,
         //as long as we have the access token either by request or by session, we can use the session
         if (is_null($this->getToken())) {
             $this->setToken((string) $accessToken);
             header("Location: " . Engine::getRemoteAbsolutePath((new Analyse())->getURL()));
         }
         //Get basic user profile information such as user id, name and email to test whether the session works
         try {
             $this->importFromJson($this->getBasicUserProfile()->getGraphUser());
         } catch (Facebook\Exceptions\FacebookResponseException $e) {
             if (strpos($e->getMessage(), "The user has not authorized application") > -1) {
                 Engine::clearSession();
                 header("Location: " . Engine::getRemoteAbsolutePath((new Home())->getURL()));
             } else {
                 throw $e;
             }
             exit;
         }
         return true;
     } else {
         return false;
     }
 }
开发者ID:shaungeorge,项目名称:facebook_analyser,代码行数:35,代码来源:User.php

示例2: deleteAccount

 private function deleteAccount($dbh)
 {
     $this->deleteResults($dbh);
     try {
         $sql = "DELETE FROM Users WHERE USER_ID='" . User::instance()->id . "'";
         $stmt = $dbh->prepare($sql);
         $stmt->execute();
         Engine::clearSession();
         header('Location: ' . Engine::getRemoteAbsolutePath((new Home())->getURL()));
     } catch (PDOException $e) {
         throw new Exception(400, "Invalid request");
     }
 }
开发者ID:shaungeorge,项目名称:facebook_analyser,代码行数:13,代码来源:Account.php


注:本文中的Engine::clearSession方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。