本文整理汇总了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);
}
示例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');
示例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');