當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Index::logOut方法代碼示例

本文整理匯總了PHP中Index::logOut方法的典型用法代碼示例。如果您正苦於以下問題:PHP Index::logOut方法的具體用法?PHP Index::logOut怎麽用?PHP Index::logOut使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Index的用法示例。


在下文中一共展示了Index::logOut方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 function __construct()
 {
     if (isset($_GET['url'])) {
         $segments = explode('/', trim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), '/'));
         switch ($segments[1]) {
             case 'index':
                 Index::setCtrl(new Home());
                 break;
             case 'form':
                 Index::setCtrl(new Form());
                 break;
             case 'form-results':
                 Index::setCtrl(new FormResults());
                 break;
             case 'oczko':
                 Index::setCtrl(new Oczko());
                 break;
             case 'angielski':
                 Index::setCtrl(new Ang());
                 break;
             case 'add-article':
                 Index::setCtrl(new AddPost());
                 break;
             case 'profile':
                 Index::setCtrl(new Profile());
                 break;
             case 'administrator':
                 if (isset($segments[2])) {
                     $action = null;
                     if (isset($segments[3]) && ($segments[3] == 'edit' || $segments[3] == 'delete' || $segments[3] == 'add' || $segments[3] == 'activeblock' || $segments[3] == 'deleteAndMove')) {
                         if (isset($segments[4]) && is_int((int) $segments[4])) {
                             $action = ['action' => $segments[3], 'id' => (int) $segments[4]];
                         } else {
                             $action = ['action' => $segments[3]];
                         }
                     }
                     $mode = null;
                     switch ($segments[2]) {
                         case 'users':
                             Index::setCtrl(new Admin('users', $action));
                             break;
                         case 'categories':
                             Index::setCtrl(new Admin('categories', $action));
                             break;
                     }
                 }
                 break;
             case 'clearSession':
                 session_destroy();
                 $this->redirect();
                 break;
             case 'address-book':
                 if (!isset($segments[2])) {
                     Index::setCtrl(new AddressBook());
                 } else {
                     if ($segments[2] == 'add') {
                         Index::setCtrl(new AddressBook('add'));
                     } else {
                         if ($segments[2] == 'delete' || $segments[2] == 'edit') {
                             if (isset($segments[3])) {
                                 Index::setCtrl(new AddressBook($segments[2], $segments[3]));
                             }
                         }
                     }
                 }
                 break;
             case 'logout':
                 Index::logOut();
                 header('Location: /~ii293327/');
                 break;
             default:
                 try {
                     switch ($segments[1]) {
                         case 'page':
                             if (is_int((int) $segments[2])) {
                                 Index::setCtrl(new Home((int) $segments[2]));
                             }
                             break;
                         case 'article':
                             if (is_int((int) $segments[2])) {
                                 Index::setCtrl(new ShowPost($segments[2]));
                             }
                             break;
                         case 'category':
                             if (is_int((int) $segments[2])) {
                                 Index::setCtrl(new Home(null, (int) $segments[2]));
                             }
                             break;
                         default:
                             Index::setCtrl(new Error(404));
                             break;
                     }
                 } catch (Exception $e) {
                     echo $e->getMessage();
                 }
         }
     } else {
         Index::setCtrl(new Home());
     }
 }
開發者ID:masteruser20,項目名稱:Blog,代碼行數:100,代碼來源:Routes.php


注:本文中的Index::logOut方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。