本文整理汇总了PHP中Flight::route方法的典型用法代码示例。如果您正苦于以下问题:PHP Flight::route方法的具体用法?PHP Flight::route怎么用?PHP Flight::route使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Flight
的用法示例。
在下文中一共展示了Flight::route方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: session_start
<?php
session_start();
define('ROOT', dirname(__FILE__));
require "flight/Flight.php";
require 'constants/conContainer.php';
require "models/modContainer.php";
require "controllers/objContainer.php";
require "tools/tooContainer.php";
/*引入配置文件*/
$error_info = parse_ini_file("configs/error.ini");
Flight::set('errorn', $error_info);
Flight::route('/', function () {
echo 'hello world! :-)';
});
Flight::start();
示例2: __construct
function __construct()
{
Flight::route("GET /test", function () {
$this->test();
});
Flight::route("POST /createuser", function () {
$this->createUSer();
});
}
示例3: __construct
function __construct()
{
Flight::route("POST /media/@namespace/@class/@id", function ($namespace, $class, $id) {
$this->uploadMedia($namespace, $class, $id);
});
Flight::route("GET /media/@namespace/@class/@id", function ($namespace, $class, $id) {
$this->getMedia($namespace, $class, $id);
});
Flight::route("GET /media/test", function () {
$this->test();
});
Flight::route("GET /thumbnails/@size/@namespace/@class/@id", function ($size, $namespace, $class, $id) {
$this->getThumbnail($size, $namespace, $class, $id);
});
}
示例4: __construct
function __construct()
{
Flight::route("GET /getInvoiceNumber", function () {
$this->getInvoiceNumber();
});
Flight::route("POST /createLedgerEntry", function () {
$this->createLedgerEntry();
});
Flight::route("POST /transactionForTennent", function () {
$this->transactionForTennent();
});
Flight::route("POST /transactionDetails", function () {
$this->TransactionDetails();
});
Flight::route("POST /payment ", function () {
$this->Payment();
});
}
示例5: function
Flight::route('/administracion/alta-de-usuario/', function () {
require_once 'controllers/administracion/usuario_controller.php';
});
Flight::route('/administracion/guarda-usuario/', function () {
require_once 'controllers/administracion/guardaUsuario_controller.php';
});
Flight::route('/administracion/duracion-de-servicios/', function () {
require_once 'controllers/administracion/duracion_servicios_controller.php';
});
Flight::route('/administracion/actualizacion-de-duracion/', function () {
require_once 'controllers/administracion/actualizaDuracion_controller.php';
});
Flight::route('/administracion/firmas-autorizadas/', function () {
require_once 'controllers/administracion/firmas_autorizadas_controller.php';
});
Flight::route('/administracion/actualiza-firmas/', function () {
require_once 'controllers/administracion/actualizaFirmas_controller.php';
});
/*Ayuda*/
Flight::route('/ayuda/cambiar-contra/', function () {
require_once 'controllers/ayuda/cambiarContra_controller.php';
});
/*Salir*/
Flight::route('/salir/', function () {
session_start();
$_SESSION = array();
session_destroy();
session_unset();
Flight::redirect('/');
});
Flight::start();
示例6: function
$cgi->getPkgAtt();
});
Flight::route('POST /user/', function () {
$user = new user\src\User();
$user->register();
});
Flight::route('GET /user/', function () {
$user = new user\src\User();
$user->getUserInfo();
});
Flight::route('PUT /user/', function () {
$user = new user\src\User();
$user->updateUserInfo();
});
Flight::route('POST /users/', function () {
$user = new user\src\User();
$user->batRegister();
});
Flight::route('GET /alluser/', function () {
$user = new user\src\User();
$user->getAllUser();
});
Flight::route('DELETE /users/', function () {
$user = new user\src\User();
$user->deleteUsers();
});
Flight::route('POST /session/', function () {
$user = new user\src\User();
$user->login();
});
Flight::start();
示例7: 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();
示例8: related
<?php
require_once 'vendor/autoload.php';
// Config views
Flight::set(array('flight.views.path' => './app', 'flight.views.extension' => '.html'));
class Api
{
public static function related($id)
{
$headers = array("Accept" => "application/json");
$url = "https://api.spotify.com/v1/artists/{$id}/related-artists";
$related_artists = Unirest\Request::get($url, $headers)->body->artists;
Flight::json($related_artists);
}
public static function toptrack($artist_id)
{
$headers = array("Accept" => "application/json");
$url = "https://api.spotify.com/v1/artists/{$artist_id}/top-tracks?country=US";
$artist_top_track = Unirest\Request::get($url, $headers)->body;
Flight::json($artist_top_track);
}
}
Flight::route('GET /', function () {
Flight::render('index');
});
Flight::route('GET /api/related/@id', array('Api', 'related'));
Flight::route('GET /api/toptrack/@artist_id', array('Api', 'toptrack'));
Flight::start();
示例9: define
<?php
// Start a Session
if (!session_id()) {
@session_start();
}
// define some constants for the project
define('PROJECT_FOLDER', '/');
define('EMAIL_TO', 'alejandro.mohamad@gmail.com');
// load libraries through composer
require_once 'vendor/autoload.php';
WingCommander::init();
Flight::set('flight.base_url', PROJECT_FOLDER);
// load dotenv
$dotenv = new Dotenv\Dotenv(__DIR__);
$dotenv->load();
// routes
Flight::route('/', array('AcaSeDona\\Home', 'index'));
Flight::route('POST /send-place', array('AcaSeDona\\Home', 'save_place'));
Flight::route('/places', array('AcaSeDona\\Home', 'display_places'));
// Flight::route('POST /send-mail', array('AcaSeDona\Contact', 'send'));
Flight::route('/backend/places', array('AcaSeDona\\Backend', 'places'));
Flight::route('/backend/hide_place/@id', array('AcaSeDona\\Backend', 'hide_place'));
Flight::start();
示例10: function
<?php
//routes
/*
Flight::route('GET /', function(){
return Flight::render('index');
});
*/
Flight::route('GET /', ['HomeController', 'index']);
示例11: function
<?php
include 'flight/Flight.php';
include 'lib/lib.php';
// GET /urn
Flight::route('GET /urn', function () {
echo '--';
});
// POST /urn
Flight::route('POST /urn/@urn', function ($urn) {
$urnValid = isUrnValid($urn);
// Build response
$response = array();
// Info
$response['info'] = array();
$response['info']['name'] = 'universal-document-server';
$response['info']['version'] = '0.1';
// Data
$response['data'] = array();
$response['data']['type'] = 'urnRequestResponse';
$response['data']['requestedUrn'] = $urn;
$response['data']['validated'] = $urnValid;
$response['data']['message'] = '';
header('Content-type: application/json');
$jsonResponse = json_encode($response);
echo $jsonResponse;
});
// Start
Flight::start();
示例12: function
<?php
require 'flight/Flight.php';
Flight::route('*', function () {
Flight::render('hello.php');
});
Flight::start();
示例13: function
<?php
require __DIR__ . '/database/bootEloquent.php';
Flight::set('flight.views.path', __DIR__ . '/views');
// routes
Flight::route('/', function () {
Flight::render('hello.php', ['pessoas' => Pessoa::all()]);
});
Flight::route('POST /pessoas', function () {
$pessoa = new Pessoa();
$pessoa->nome = Flight::request()->data['nome'];
$pessoa->save();
Flight::redirect('/');
});
Flight::start();
示例14: array
<?php
// Index
Flight::route('/', array('IndexController', 'index'));
// Php Infos
Flight::route('/php-infos', array('IndexController', 'phpInfos'));
// Symfony Infos
Flight::route('/symfony', array('IndexController', 'symfony'));
// Majesteel Infos
Flight::route('/majesteel', array('IndexController', 'majesteel'));
示例15: session_start
session_start();
//главная страница
Flight::route('/(\\?p=@p)', function ($p) {
$s_login = SetLogin();
//gettin page index
$page = 1;
if ($p > 1) {
$page = $p;
}
$postselector = ($page - 1) * 5;
$posts = Flight::db()->GetPosts($postselector, 5);
$postscount = Flight::db()->CountPosts();
$pages_count = ceil($postscount / 5);
Flight::render('home.php', array('headertext' => 'Мой летучий блог', 'authorname' => $s_login, 'footertext' => '@ProgForce forever'), 'home_page_content');
Flight::render('post.php', array('posts' => $posts), 'posts_block');
Flight::render('page_hyperlinks.php', array('pages_count' => $pages_count, 'current_page' => $page), 'pages_n_links');
Flight::render('auth_view.php', null, 'auth_view');
Flight::render('home_layout.php', null);
});
Flight::route('/exit', function () {
session_destroy();
Flight::redirect('/');
});
Flight::route('/auth/', function () {
Flight::render('auth.php', null);
});
/*Flight::route('POST /authconfirm/', function()
{
Flight::render('authconfirm.php',array('post_args' => $_POST));
});*/
Flight::start();