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


PHP Slim::deleteCookie方法代碼示例

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


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

示例1: clear

 /**
  * Clears contents from storage
  *
  * @throws Zend_Auth_Storage_Exception If clearing contents from
  *                                     storage is impossible
  * @return void
  */
 public function clear()
 {
     $this->app->deleteCookie($this->cookieName);
 }
開發者ID:kxopa,項目名稱:slim-skeleton,代碼行數:11,代碼來源:EncryptedCookie.php

示例2: AuthenticateFailedException

            // OK
            echo json_encode(array('operation' => 'login', 'status' => 'ok'));
        } else {
            throw new AuthenticateFailedException();
        }
    } catch (AuthenticateFailedException $e) {
        $app->response()->status(401);
        $app->response()->header('X-Status-Reason', 'Login failure');
    } catch (Exception $e) {
        $app->response()->status(400);
        $app->response()->header('X-Status-Reason', $e->getMessage());
    }
});
$app->get('/logout', function () use($app) {
    try {
        $app->deleteCookie('username');
        $app->deleteCookie('password');
        $app->response()->header('Content-Type', 'application/json');
        $app->response()->status(200);
        // OK
        echo json_encode(array('operation' => 'logout', 'status' => 'ok'));
    } catch (Exception $e) {
        $app->response()->status(400);
        $app->response()->header('X-Status-Reason', $e->getMessage());
    }
});
// API for CRUD operations on articles
// handle GET requests for /index.php/articles
$app->get('/articles', $authenticateUser($app), function () use($app) {
    // query database for all articles
    $articles = R::find('articles');
開發者ID:gsokolowski,項目名稱:Php-REST-Slim-RedBean-authentication,代碼行數:31,代碼來源:index.php

示例3: function

            $app->flash('error', 'Too many failed attempts. Try again later.');
            $app->redirect($app->urlFor('login'));
        }
    } else {
        $app->flash('error', "All Fields Required");
        $app->redirect($app->urlFor('login'));
    }
    // END Required fields
});
// Logout page
$app->get("/logout", function () use($app, $dl) {
    // Remove the session id from the database
    // logout($username);
    unset($_SESSION['usr']);
    unset($_SESSION['sid']);
    $app->deleteCookie('urlRedirect');
    $app->view()->setData('usr', null);
    $app->flash('loggedout', 'You\'ve been logged out');
    $app->redirect($app->urlFor('login'));
});
// Temporary Admin Page
$app->get('/admin', $authenticate($app, $dl), function () use($app) {
    $app->redirect($app->urlFor('login'));
})->name('admin');
// Admin Dashboard
$app->get('/admin/dashboard', $authenticate($app, $dl), function () use($app, $dl) {
    $app->render('dashboard.twig', array('albums' => $dl->get_albums(), 'redeemed' => $dl->admin->display_emails()));
})->name('dashboard');
$app->post('/admin/dashboard', $authenticate($app, $dl), function () use($app, $dl) {
    $track_album = $app->request->post('album_codes');
    $tracks = $app->request->post('album_track');
開發者ID:nblakefriend,項目名稱:download,代碼行數:31,代碼來源:index.php


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