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


PHP Router::addPost方法代碼示例

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


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

示例1: addRoutes

 public function addRoutes(Router $router)
 {
     $router->add('/' . $this->getApiRootUrl() . '(\\/?)', array('namespace' => $this->getApiControllerRootNamespace(), 'controller' => 'Index', 'action' => 'index'));
     $router->addGet('/' . $this->getApiRootUrl() . '/:controller/:params', array('namespace' => $this->getApiControllerRootNamespace(), 'controller' => 1, 'action' => 'show', 'params' => 2));
     $router->addGet('/' . $this->getApiRootUrl() . '/:controller', array('namespace' => $this->getApiControllerRootNamespace(), 'controller' => 1, 'action' => 'index'));
     $router->addPost('/' . $this->getApiRootUrl() . '/:controller', array('namespace' => $this->getApiControllerRootNamespace(), 'controller' => 1, 'action' => 'create'));
     $router->addOptions('/' . $this->getApiRootUrl() . '/:controller', array('namespace' => $this->getApiControllerRootNamespace(), 'controller' => 1, 'action' => 'options'));
     $router->addOptions('/' . $this->getApiRootUrl() . '/:controller/:params', array('namespace' => $this->getApiControllerRootNamespace(), 'controller' => 1, 'action' => 'options'));
     $router->addDelete('/' . $this->getApiRootUrl() . '/:controller/:params', array('namespace' => $this->getApiControllerRootNamespace(), 'controller' => 1, 'action' => 'delete', 'params' => 2));
     $router->addPut('/' . $this->getApiRootUrl() . '/:controller/:params', array('namespace' => $this->getApiControllerRootNamespace(), 'controller' => 1, 'action' => 'update', 'params' => 2));
 }
開發者ID:bullhorn,項目名稱:fast-rest,代碼行數:11,代碼來源:ApiRoutes.php

示例2: Router

$router = new Router(false);
$router->removeExtraSlashes(true);
$router->add('/help/stats', ['controller' => 'help', 'action' => 'stats']);
$router->add('/help/about', ['controller' => 'help', 'action' => 'about']);
$router->add('/help/moderators', ['controller' => 'help', 'action' => 'moderators']);
$router->add('/help/voting', ['controller' => 'help', 'action' => 'voting']);
$router->add('/help/markdown', ['controller' => 'help', 'action' => 'markdown']);
$router->add('/help/karma', ['controller' => 'help', 'action' => 'karma']);
$router->add('/help/badges', ['controller' => 'help', 'action' => 'badges']);
$router->add('/help/create-post', ['controller' => 'help', 'action' => 'create']);
$router->add('/help', ['controller' => 'help', 'action' => 'index']);
$router->add('/discussions', ['controller' => 'discussions', 'action' => 'index']);
$router->add('/hook/mail-bounce', ['controller' => 'hooks', 'action' => 'mailBounce']);
$router->add('/hook/mail-reply', ['controller' => 'hooks', 'action' => 'mailReply']);
$router->add('/search', ['controller' => 'discussions', 'action' => 'search']);
$router->addPost('/preview', ['controller' => 'utils', 'action' => 'preview']);
$router->add('/reply/accept/{id:[0-9]+}', ['controller' => 'replies', 'action' => 'accept']);
$router->add('/reply/vote-up/{id:[0-9]+}', ['controller' => 'replies', 'action' => 'voteUp']);
$router->add('/reply/vote-down/{id:[0-9]+}', ['controller' => 'replies', 'action' => 'voteDown']);
$router->add('/reply/history/{id:[0-9]+}', ['controller' => 'replies', 'action' => 'history'])->beforeMatch([new Ajax(), 'check']);
$router->add('/discussion/history/{id:[0-9]+}', ['controller' => 'discussions', 'action' => 'history'])->beforeMatch([new Ajax(), 'check']);
$router->add('/discussion/vote-up/{id:[0-9]+}', ['controller' => 'discussions', 'action' => 'voteUp']);
$router->add('/poll/vote/{id:[0-9]+}/{option:[0-9]+}', ['controller' => 'polls', 'action' => 'vote']);
$router->add('/discussion/vote-down/{id:[0-9]+}', ['controller' => 'discussions', 'action' => 'voteDown']);
$router->add('/login/oauth/authorize', ['controller' => 'session', 'action' => 'authorize']);
$router->add('/login/oauth/access_token/', ['controller' => 'session', 'action' => 'accessToken']);
$router->add('/login/oauth/access_token', ['controller' => 'session', 'action' => 'accessToken']);
$router->add('/logout', ['controller' => 'session', 'action' => 'logout']);
$router->add('/find-related', ['controller' => 'discussions', 'action' => 'findRelated']);
$router->add('/show-related', ['controller' => 'discussions', 'action' => 'showRelated']);
$router->add('/notifications', ['controller' => 'discussions', 'action' => 'notifications']);
開發者ID:phalcon,項目名稱:forum,代碼行數:31,代碼來源:routes.php

示例3: Router

<?php

use Phalcon\Mvc\Router;
$router = new Router(false);
$router->removeExtraSlashes(true);
$router->addGet("/", ['controller' => 'index', 'action' => 'index']);
$router->addPost("/", ['controller' => 'index', 'action' => 'handleCardSubmit']);
$router->addGet('/index/success', ['controller' => 'index', 'action' => 'success']);
return $router;
開發者ID:byhbt,項目名稱:napthe-baokim,代碼行數:9,代碼來源:routes.php

示例4: Router

<?php

use Phalcon\Mvc\Router;
$router = new Router();
//Remove trailing slashes automatically
$router->removeExtraSlashes(true);
//main route
$router->add("/", array('controller' => 'index', 'action' => 'index'));
//GET VERB - GET ELEMENT
//Get elemets of relationship. Ex: /department/2/user
$router->addGet('/:controller/:int/([a-zA-Z0-9_-]+)', array('controller' => 1, 'action' => "list", 'id' => 2, 'relationship' => 3));
//Get one element. Ex: /user/2
$router->addGet('/:controller/:int', array('controller' => 1, 'action' => "get", 'id' => 2));
//Get all elements. Ex: /user
$router->addGet('/:controller', array('controller' => 1, 'action' => "list"));
//POST VERB - CREATE ELEMENT
//Create a new element. Ex: /user
$router->addPost('/:controller', array('controller' => 1, 'action' => "save"));
//PUT VERB - UPDATE ELEMENT
//Update a new element. Ex: /user
$router->addPut('/:controller/:int', array('controller' => 1, 'action' => "save", 'id' => 2));
//DELETE VERB - UPDATE ELEMENT
//Update a new element. Ex: /user
$router->addDelete('/:controller/:int', array('controller' => 1, 'action' => "delete", 'id' => 2));
//not founded route
$router->notFound(array('controller' => 'error', 'action' => 'page404'));
$router->setDefaults(array('controller' => 'index', 'action' => 'index'));
return $router;
開發者ID:GeraldoSilva,項目名稱:API-REST-PHALCON-PHP,代碼行數:28,代碼來源:routes.php

示例5: Router

<?php

use Phalcon\Mvc\Router;
$router = new Router();
$router->addGet("/", array("controller" => "index"));
$router->addPost("/new", array("controller" => "new"));
// Covers /v/ and /view/
$router->addGet("/v(iew)?/([a-zA-Z0-9]{5,13})", array("controller" => "view", "id" => 2));
$router->addGet("/v(iew)?/([a-zA-Z0-9]{5,13})/raw", array("controller" => "view", "action" => "raw", "id" => 2));
$router->removeExtraSlashes(true);
return $router;
開發者ID:carriercomm,項目名稱:Phaste,代碼行數:11,代碼來源:routes.php

示例6: function

/**
 * Start the session the first time some component request the session service
 */
$di->set('session', function () {
    $session = new SessionAdapter();
    $session->start();
    return $session;
});
/**
 * Register configurations
 */
$di->set('config', function () use($config) {
    return $config;
});
/**
 * Register router
 */
$di->set('router', function () {
    $router = new Router();
    $router->removeExtraSlashes(true);
    $router->setDefaults(['controller' => 'index', 'action' => 'index']);
    /*$router->notFound([
          'controller'    => 'errors',
          'action'        => 'pageNotFound'
      ]);*/
    $router->addGet('/project/{profile:([a-zA-Z0-9-(.)]+)}', ['action' => 'profile', 'project' => 1]);
    $router->addPost('/filter', ['action' => 'filter'])->beforeMatch(function ($uri, $route) {
        return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest';
    });
    return $router;
});
開發者ID:antsand,項目名稱:builtwith,代碼行數:31,代碼來源:bootstrap.php

示例7: addPost

 public function addPost($pattern, $paths = null, $position = Router::POSITION_LAST)
 {
     return parent::addPost($pattern, $paths, $position);
 }
開發者ID:mattvb91,項目名稱:cphalcon,代碼行數:4,代碼來源:Router.php


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