本文整理汇总了PHP中Router::post方法的典型用法代码示例。如果您正苦于以下问题:PHP Router::post方法的具体用法?PHP Router::post怎么用?PHP Router::post使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Router
的用法示例。
在下文中一共展示了Router::post方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testMatchingCheckesMethod
public function testMatchingCheckesMethod()
{
$this->setExpectedException('Vexillum\\Http\\PageNotFoundException');
$route = Router::post('/apath', function () {
});
Router::run('GET', 'localboat.dev', '/apath');
}
示例2: testPost
public function testPost()
{
$_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['REQUEST_URI'] = '/test';
$t = false;
Router::post('/test', function () use(&$t) {
$t = true;
return false;
})->process();
$this->assertTrue($t);
}
示例3: testRoutes
/**
* @covers Zepto\Router::routes()
*/
public function testRoutes()
{
$this->router->get('/get', function () {
return 'This is a get route';
});
$this->router->post('/post', function () {
return 'This is a post route';
});
$routes = $this->router->routes();
$this->assertArrayHasKey('GET', $routes);
$this->assertArrayHasKey('#^/get/$#', $routes['GET']);
$this->assertInstanceOf('Zepto\\Route', $routes['GET']['#^/get/$#']);
$this->assertArrayHasKey('POST', $routes);
$this->assertArrayHasKey('#^/post/$#', $routes['POST']);
$this->assertInstanceOf('Zepto\\Route', $routes['POST']['#^/post/$#']);
}
示例4: function
});
$router->get('login', function () use($auth, $config, $session) {
if (!$config->isInitialized()) {
header("Location: " . ROOT . "install");
}
if ($auth->isConnected()) {
header("Location: " . ROOT);
} else {
require "template/login.php";
}
});
$router->post('login', function () use($auth, $config, $session) {
if ($auth->login($_POST["email"], $_POST["pass"])) {
$session->setFlash("info", "Connexion réussie");
header("Location: " . ROOT);
} else {
$session->setFlash("info", "Identifiants incorrects");
}
require "template/login.php";
});
$router->get('install', function () use($auth, $config, $session) {
if ($config->isInitialized()) {
header("Location: " . ROOT);
die;
}
require "template/install.php";
});
$router->post('install', function () use($auth, $config, $session) {
if ($config->isInitialized()) {
header("Location: " . ROOT);
die;
示例5: function
<?php
namespace App\Controller;
Router::get('/', "PrincipalController@index");
Router::get('professor', "ProfessorController@index");
Router::get('atividade', "AtividadeController@index");
Router::get('coordenador', "CoordenadorController@index");
Router::get('login', "UserController@index");
Router::post('login', "UserController@login");
Router::get('logout', "UserController@logout");
/*
Router::get('other/@nome/@email', function($nome, $email){
echo $nome." - ".$email;
});
*/
示例6: Router
<?php
require_once 'Core' . DIRECTORY_SEPARATOR . 'config.php';
require_once 'Core' . DIRECTORY_SEPARATOR . 'autoload.php';
use Core\Config\Autoload;
Autoload::load($load);
$router = new Router();
$router->get('/', 'PageController::index');
/* Ajax */
$router->post('/connect', 'MemberController::connect');
$router->post('/chatroom', 'MemberController::get_chat_room');
$router->post('/notif', 'MessageController::get_notif');
$router->post('/chatroom/name', 'MemberController::get_chat_name');
$router->post('/contact/add', 'MemberController::add_contact');
$router->post('/message/last', 'MessageController::get_last_message');
$router->post('/message/new', 'MessageController::get_new_message');
$router->post('/message/send', 'MessageController::send');
$router->add_404('PageController::route_404');
$router->run();
示例7: Router
<?php
$r = new Router($app, $ds);
$r->get('/', 'IndexController');
$r->get('/workout', 'WorkoutScheduleController');
$r->get('/workout/:id', 'WorkoutController');
$r->post('/workout/:id', 'WorkoutController');
$r->get('/stats', 'WorkoutLogController');
$r->get('/login', 'LoginController');
$r->post('/login', 'LoginController');
$r->get('/logout', 'LogoutController');
$r->post('/logout', 'LogoutController');
$r->get('/help', 'LoadTemplateController', 'help.php');
$r->get('/tos', 'LoadTemplateController', 'tos.php');
$r->get('/about', 'LoadTemplateController', 'about.php');
$admin_middleware = new AdminMiddleware($app);
$r->group('/admin', function ($r) {
$r->get('/', 'admin\\IndexController');
$r->get('/new-customer', 'admin\\NewCustomerController');
$r->get('/new-workout/:user_id', 'admin\\NewWorkoutController');
});
//, $admin_middleware);
unset($r);
unset($admin_middleware);
示例8:
<?php
require 'app/core/autoloader.php';
//define routes
Router::get('', 'welcome@index');
Router::get('admin', 'admin@admin');
Router::get('admin/login', 'admin@login');
Router::post('admin/login', 'admin@login');
Router::get('admin/logout', 'admin@logout');
//if no route found
Router::error('error@index');
//execute matched routes
Router::dispatch();
ob_flush();
示例9: Router
<?php
require_once 'Core' . DIRECTORY_SEPARATOR . 'config.php';
require_once 'Core' . DIRECTORY_SEPARATOR . 'autoload.php';
use Core\Config\Autoload;
Autoload::load($load);
$router = new Router();
$router->get('/', 'PageController::index');
$router->get('/jeu', 'JeuController::index');
$router->post('/jeu/end', 'JeuController::save');
$router->post('/jeu/inscription', 'JeuController::inscription');
$router->get('/mail/{id}/{cle}', 'JeuController::mail');
$router->get('/date', 'DateController::get_date');
/* ADMIN */
$router->get('/admin', 'AdminController::login');
$router->post('/admin', 'AdminController::connexion');
$router->get('/admin/logout', 'AdminController::logout');
$router->get('/admin/dashboard', 'AdminController::classement');
$router->get('/admin/classement', 'AdminController::classement');
$router->get('/admin/joueurs', 'AdminController::info_joueur');
$router->post('/admin/joueurs/edit/{id}', 'AdminController::save_joueur');
$router->post('/admin/joueurs/add', 'AdminController::add_joueur');
$router->post('/admin/joueurs/remove/{id}', 'AdminController::remove_joueur');
$router->get('/admin/galerie', 'AdminController::galerie');
$router->post('/admin/galerie/edit/{id}', 'AdminController::save_photo');
$router->post('/admin/galerie/add', 'AdminController::add_photo');
$router->post('/admin/galerie/remove/{id}', 'AdminController::remove_photo');
$router->get('/admin/partenaire', 'AdminController::partenaire');
$router->post('/admin/partenaire/edit/{id}', 'AdminController::save_partenaire');
$router->post('/admin/partenaire/add', 'AdminController::add_partenaire');
$router->post('/admin/partenaire/remove/{id}', 'AdminController::remove_partenaire');
示例10: Router
<?php
$route = new Router();
//GET ROUTES
//pages
$route->get(URL . '/', ['PagesController', 'index']);
$route->get(URL . '/dns-list', ['DnsController', 'dnsList']);
//auth
$route->get(URL . '/login', ['AuthController', 'login']);
$route->get(URL . '/register', ['AuthController', 'register']);
$route->get(URL . '/profile', ['AuthController', 'profile']);
$route->get(URL . '/logout', ['AuthController', 'logout']);
//management
$route->get(URL . '/addDomainNameSystem', ['DnsController', 'addDomainNameSystem']);
$route->get(URL . '/dns_edit', ['DnsController', 'editDomainNameSystem']);
$route->get(URL . '/dns_delete', ['DnsController', 'deleteDomainNameSystem']);
$route->get(URL . '/downloadFile', ['DnsController', 'downloadDnsZoneFile']);
//POST ROUTES
//auth
$route->post(URL . '/loginPOST', ['AuthController', 'login_POST']);
$route->post(URL . '/registerPOST', ['AuthController', 'register_POST']);
$route->post(URL . '/profilePOST', ['AuthController', 'editProfile_POST']);
///management
$route->post(URL . '/addDomainNameSystemPOST', ['DnsController', 'addDomainNameSystem_POST']);
$route->post(URL . '/editDomainNameSystemPOST', ['DnsController', 'editDomainNameSystem_POST']);
//create zones file
$route->post(URL . '/createDnsZoneFile', ['DnsController', 'createDnsZoneFile']);
示例11:
<?php
Router::getInstance();
Router::get('', 'HomeController@index');
Router::get('a-propos', 'PagesController@about');
Router::get('soumettre', 'SubmitController@index');
Router::post('soumettre', 'SubmitController@submit');
Router::get('questions', 'ListController@recent');
Router::get('p', 'QuoteController@single');
Router::get('phrases', 'QuoteController@index');
Router::_404('ErrorController@_404');
示例12: Router
<?php
require_once 'Core' . DIRECTORY_SEPARATOR . 'config.php';
require_once 'Core' . DIRECTORY_SEPARATOR . 'autoload.php';
use Core\Config\Autoload;
Autoload::load($load);
$router = new Router();
$router->get('/', 'PageController::index');
$router->get('/create', 'GameController::create');
$router->post('/game', 'GameController::game');
$router->add_404('PageController::route_404');
$router->run();
示例13: Router
<?php
require_once 'Core' . DIRECTORY_SEPARATOR . 'config.php';
require_once 'Core' . DIRECTORY_SEPARATOR . 'autoload.php';
use Core\Config\Autoload;
Autoload::load($load);
$router = new Router();
$router->get('/', 'PageController::index');
$router->get('/create', 'GameController::get_create');
$router->post('/create', 'GameController::post_create');
$router->get('/join', 'GameController::get_join');
$router->post('/join', 'GameController::post_join');
$router->post('/game', 'GameController::get_game');
$router->post('/players', 'GameController::get_players');
$router->post('/narrator', 'GameController::get_narrator');
$router->get('/chat', 'PageController::chat');
$router->post('/new', 'MessageController::get_new_message');
$router->post('/send', 'MessageController::send_message');
$router->post('/last', 'MessageController::get_last_message');
$router->post('/contact', 'MessageController::get_contact');
$router->post('/notif', 'MessageController::get_notification');
$router->add_404('PageController::route_404');
$router->run();
示例14: array
<?php
Router::post("/signin", array("controller" => "AuthController", "method" => "signin"));
Router::post("/signup", array("controller" => "AuthController", "method" => "signup"));
Router::post("/signout", array("controller" => "AuthController", "signout" => "signout"));
# VALID POST REQUESTS
Router::post("/", array("controller" => "TestController", "method" => "post_test"));
示例15: post
protected function post($regex, $callback)
{
Router::post($regex, $callback);
}