本文整理汇总了PHP中Flight::stop方法的典型用法代码示例。如果您正苦于以下问题:PHP Flight::stop方法的具体用法?PHP Flight::stop怎么用?PHP Flight::stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Flight
的用法示例。
在下文中一共展示了Flight::stop方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: response
public static function response($http_code, $message = '')
{
//send a response to the client
if (!is_null(json_decode($message))) {
$message = json_decode($message);
}
$message = self::json_string_response($http_code, $message);
//die('DIE : '.$message);
//if(DEBUG) $message .= self::$db->last_query();
Flight::halt($http_code, $message);
Flight::stop();
}
示例2: function
Flight::route('/', function () {
return Flight::view()->display('index.php', Flight::get('config')->getTemplateData());
});
// ! --- ROUTE: About ---------------------------
Flight::route('/we', function () {
return Flight::get('config')->renderPage('about');
});
// ! --- ROUTE: Sitemap -------------------------
/**
* Publishes all routes in the /sitemap.xml
*/
Flight::route('/sitemap.xml', function () {
$items = Flight::get('navigation.loader')->getNavigationItems();
$sitemap = array();
foreach ($items as $item) {
$sitemap[] = array('Url' => $item->get('Url'), 'DateTime' => $item->get('DateTime'));
}
Flight::response()->header('Content-Type', 'application/xml');
Flight::view()->display('sitemap.php', array('Sitemap' => $sitemap));
});
// ! --- ROUTE: Project -------------------------
Flight::route('/@name', function ($name) {
return Flight::get('config')->renderPage($name);
});
// ! --- ROUTE: 404 - Not Found -----------------
Flight::map('notFound', function () {
Flight::view()->display('404.php', Flight::get('config')->getTemplateData());
Flight::stop(404);
});
// ! --- Kick things off! -----------------------
Flight::start();
示例3: handle_checkin
function handle_checkin()
{
render_boilerplate();
// This happens if we unset the nonce below.
// Or if the nonce was never set, in which case the user
// shouldn't be here.
$msg1 = _('It looks like you accidentally hit the refresh button or got here by accident.');
$msg2 = _('We prevented a double post of your message.');
if (!array_key_exists('FB_CHECKIN_NONCE', $_SESSION)) {
Flight::render('denied_fb', array('msg' => $msg1 . ' ' . $msg2));
Flight::stop();
}
$nonce = $_SESSION['FB_CHECKIN_NONCE'];
if (empty($nonce)) {
Flight::render('denied_fb', array('msg' => $msg1 . ' ' . $msg2));
Flight::stop();
}
$submitted_nonce = Flight::request()->query->nonce;
if (empty($submitted_nonce)) {
Flight::error(new Exception('No nonce in form submission!'));
}
if ($nonce !== $submitted_nonce) {
Flight::error(new Exception('Nonces don\'t match!'));
}
// Now, make double submissions impossible by discarding the
// nonce
unset($_SESSION['FB_CHECKIN_NONCE']);
$token = $_SESSION['FBTOKEN'];
if (empty($token)) {
Flight::error(new Exception('No FB token in session!'));
}
$session = new FacebookSession($token);
$message = Flight::request()->query->message;
$config = array(place => PAGE_ID);
if (!empty($message)) {
$config['message'] = $message;
}
$request = new FacebookRequest($session, 'POST', '/me/feed', $config);
// Some exceptions can be caught and handled sanely,
// e.g. Duplicate status message (506)
try {
$response = $request->execute()->getGraphObject();
} catch (FacebookRequestException $ex) {
Flight::error($ex);
} catch (\Exception $ex) {
Flight::error($ex);
}
$postid = $response->asArray()['id'];
$posturl = 'https://www.facebook.com/' . $postid;
Flight::render('checkin', array('loginurl' => login_success(False), 'posturl' => $posturl));
}
示例4: response
public static function response($http_code, $message = '')
{
//send a response to the client
if (!is_null(json_decode($message))) {
$message = json_decode($message);
}
//HACK for WLS
$content = self::json_string_response($http_code, $message);
//HACK for WLS
$http_code = 200;
//200 HACK FLASH WLS
Flight::halt($http_code, $content);
Flight::stop();
}
示例5: function
<?php
require 'flight/Flight.php';
require "config.php";
require "handler.php";
include 'jwt/BeforeValidException.php';
include 'jwt/ExpiredException.php';
include 'jwt/SignatureInvalidException.php';
include 'jwt/JWT.php';
include "jwt/jwthelper.php";
Flight::route('/', function () {
echo Flight::get("dbname");
});
Flight::route("POST /user/register", array("Handler", "reg"));
Flight::route("POST /user/login", array("Handler", "log"));
Flight::route("POST /snippets", array("Handler", "snippets"));
Flight::route("POST /snippet", array("Handler", "snippet"));
Flight::route("POST /key/valid", array("Handler", "validate"));
Flight::register("db", "PDO", array("mysql:host=" . Flight::get("dbhost") . ";dbname=" . Flight::get("dbname") . ";charset=utf8;", Flight::get("dbuser"), Flight::get("dbpass")));
Flight::map("error", function ($err = "error") {
Flight::halt(404, $err);
Flight::stop();
});
Flight::start();