当前位置: 首页>>代码示例>>PHP>>正文


PHP Router::routes方法代码示例

本文整理汇总了PHP中Router::routes方法的典型用法代码示例。如果您正苦于以下问题:PHP Router::routes方法的具体用法?PHP Router::routes怎么用?PHP Router::routes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Router的用法示例。


在下文中一共展示了Router::routes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 public function index()
 {
     // Taken from repos
     # The DOC_ROOT and APP_PATH constant have to happen in the actual app
     # Document root, ex: /path/to/home/app.com/../ (uses ./ on CLI)
     define('DOC_ROOT', empty($_SERVER['DOCUMENT_ROOT']) ? './' : realpath($_SERVER['DOCUMENT_ROOT']) . '/../');
     # App path, ex: /path/to/home/app.com/
     define('APP_PATH', realpath(dirname(__FILE__)) . '/');
     # Environment
     require_once DOC_ROOT . 'environment.php';
     # Where is core located?
     define('CORE_PATH', $_SERVER['DOCUMENT_ROOT'] . "/../core/");
     # Load app configs
     require APP_PATH . "/config/config.php";
     require APP_PATH . "/config/feature_flags.php";
     # Bootstrap
     require CORE_PATH . "bootstrap.php";
     # Routing
     Router::$routes = array('/' => '/index');
     # Match requested uri to any routes and instantiate controller
     Router::init();
     # Display environment details
     require CORE_PATH . "environment-details.php";
     echo "This is the index page";
 }
开发者ID:rebekahheacock,项目名称:dwa15-archive,代码行数:25,代码来源:c_upload_form.php

示例2: AddRoute

 /**
  * Добавить маршрут
  * Add Route
  */
 public static function AddRoute($route, $destination = null)
 {
     if ($destination != null && !is_array($route)) {
         $route = array($route => $destination);
     }
     self::$routes = array_merge(self::$routes, $route);
 }
开发者ID:odin3,项目名称:MoyService,代码行数:11,代码来源:router.php

示例3: tearDown

 /**
  * Destroy the test environment
  */
 public function tearDown()
 {
     Config::set('application.url', '');
     Config::set('application.index', 'index.php');
     Router::$names = array();
     Router::$routes = array();
 }
开发者ID:gigikiri,项目名称:masjid-l3,代码行数:10,代码来源:html.test.php

示例4: tearDown

 /**
  * Destroy the test environment.
  */
 public function tearDown()
 {
     // @todo clear httpfoundation request data
     Config::set('session.driver', '');
     Router::$routes = array();
     Router::$names = array();
     URL::$base = '';
     Config::set('application.index', 'index.php');
     Session::$instance = null;
 }
开发者ID:SerdarSanri,项目名称:laravel-simplemessage,代码行数:13,代码来源:redirect.test.php

示例5: 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/$#']);
 }
开发者ID:hassankhan,项目名称:sonic,代码行数:19,代码来源:RouterTest.php

示例6: start

 public static function start()
 {
     if (!empty($_GET['routes'])) {
         $r = $_GET['routes'];
         unset($_GET['routes']);
     } else {
         $r = '';
     }
     self::$routes = explode('/', $r);
     if (count(self::$routes) <= 2) {
         self::getCtrlNames();
         self::model();
         self::controller();
     } else {
         self::module();
     }
 }
开发者ID:helloris25,项目名称:mvc,代码行数:17,代码来源:router.php

示例7: testRoutableContentTypes

 public function testRoutableContentTypes()
 {
     $Type = ClassRegistry::init('Taxonomy.Type');
     $type = $Type->create(array('title' => 'Press Release', 'alias' => 'press-release', 'description' => ''));
     $Type->save($type);
     $type = $Type->findByAlias('press-release');
     CroogoRouter::routableContentTypes();
     $params = array('url' => array(), 'plugin' => 'nodes', 'controller' => 'nodes', 'action' => 'index', 'type' => 'press-release');
     $result = Router::reverse($params);
     $this->assertEquals('/nodes/nodes/index/type:press-release', $result);
     $type['Type']['params'] = 'routes=1';
     $Type->save($type);
     Router::$routes = array();
     CroogoRouter::routableContentTypes();
     $result = Router::reverse($params);
     $this->assertEquals('/press-release', $result);
 }
开发者ID:laiello,项目名称:plankonindia,代码行数:17,代码来源:CroogoRouterTest.php

示例8: initialize

 public static function initialize()
 {
     global $HTTP_RAW_POST_DATA;
     global $_PUT;
     global $_PST;
     self::$routes = SiteStructure::get_routes();
     require_once CONFIG . 'routes.php';
     self::admin_routes();
     // Format PUT/POST data as an associative array
     if ($_SERVER['REQUEST_METHOD'] === 'PUT') {
         $_PUT = json_decode(file_get_contents('php://input'), TRUE);
     } elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
         $_PST = json_decode($HTTP_RAW_POST_DATA, TRUE);
         foreach ($_POST as $key => $value) {
             $_PST[$key] = $value;
         }
     }
 }
开发者ID:wileybenet,项目名称:mobile-docs,代码行数:18,代码来源:router.php

示例9: start

 public static function start()
 {
     $r = !empty($_GET['routes']) ? $_GET['routes'] : '';
     self::$routes = explode('/', $r);
     $params = self::$routes;
     unset(self::$params[0], self::$params[1]);
     switch (self::$routes[0]) {
         case 'module1':
         case 'module2':
             unset(self::$params[2]);
             self::$params = array_values($params);
             self::module();
             break;
         default:
             self::$params = array_values($params);
             self::getCtrlNames();
             self::model();
             self::controller();
     }
 }
开发者ID:helloris25,项目名称:mvc,代码行数:20,代码来源:router.php

示例10: testAddingARoute

 public function testAddingARoute()
 {
     $route = Router::get('/', function () {
     });
     $this->assertContains($route, Router::routes());
 }
开发者ID:kiasaki,项目名称:vexillum,代码行数:6,代码来源:RouterTest.php

示例11:

<?php

namespace NinjaWars\core;

/*
 * Adding a default entry helps for when the action is not found or not
 * provided, otherwise a 404 will occur.
 */
Router::$routes = ['api' => ['type' => 'controller', 'actions' => ['default' => 'nw_json']], 'signup' => ['type' => 'controller'], 'login' => ['type' => 'controller', 'actions' => ['login_request' => 'requestLogin']], 'clan' => ['type' => 'controller', 'actions' => ['new' => 'create', 'default' => 'listClans', 'list' => 'listClans']], 'list' => ['type' => 'controller', 'actions' => []], 'shop' => ['type' => 'controller', 'actions' => ['purchase' => 'buy']], 'work' => ['type' => 'controller', 'actions' => ['request_work' => 'requestWork']], 'shrine' => ['type' => 'controller', 'actions' => ['heal_and_resurrect' => 'healAndResurrect']], 'doshin' => ['type' => 'controller', 'actions' => ['Bribe' => 'bribe', 'Offer Bounty' => 'offerBounty']], 'duel' => ['type' => 'controller', 'actions' => []], 'stats' => ['type' => 'controller', 'actions' => ['change_details' => 'changeDetails', 'update_profile' => 'updateProfile']], 'npc' => ['type' => 'controller', 'actions' => []], 'events' => ['type' => 'controller', 'actions' => []], 'messages' => ['type' => 'controller', 'actions' => ['delete_clan' => 'deleteClan', 'delete_messages' => 'deletePersonal', 'delete_message' => 'deletePersonal', 'send_clan' => 'sendClan', 'send_personal' => 'sendPersonal', 'personal' => 'viewPersonal', 'message' => 'viewPersonal', 'clan' => 'viewClan', 'default' => 'viewPersonal']], 'account' => ['type' => 'controller', 'actions' => ['show_change_email_form' => 'showChangeEmailForm', 'change_email' => 'changeEmail', 'show_change_password_form' => 'showChangePasswordForm', 'change_password' => 'changePassword', 'show_confirm_delete_form' => 'deleteAccountConfirmation', 'delete_account' => 'deleteAccount']], 'inventory' => ['type' => 'controller', 'actions' => ['use' => 'useItem', 'self_use' => 'selfUse']], 'skill' => ['type' => 'controller', 'actions' => ['use' => 'useSkill', 'self_use' => 'selfUse', 'post_use' => 'postUse', 'post_self_use' => 'postSelfUse']], 'quest' => ['type' => 'controller', 'actions' => []], 'consider' => ['type' => 'controller', 'actions' => ['add' => 'addEnemy', 'delete' => 'deleteEnemy']], 'assistance' => ['type' => 'controller', 'actions' => []], 'password' => ['type' => 'controller', 'actions' => ['post_email' => 'postEmail', 'post_reset' => 'postReset', 'reset' => 'getReset']], 'chat' => ['type' => 'controller', 'actions' => ['receive' => 'receive']], 'map' => ['type' => 'controller', 'actions' => ['view' => 'index']], 'player' => ['type' => 'controller', 'actions' => []], 'news' => ['type' => 'controller', 'actions' => []], 'error' => ['type' => 'controller', 'action' => []], 'rules' => ['type' => 'simple', 'title' => 'Rules'], 'staff' => ['type' => 'simple', 'title' => 'Staff'], 'public' => ['type' => 'simple', 'title' => 'Public Discussion'], 'interview' => ['type' => 'simple', 'title' => 'Interview with John Facey'], 'about' => ['type' => 'simple', 'title' => 'About NinjaWars'], 'intro' => ['type' => 'simple', 'title' => 'Intro to the game']];
Router::$controllerAliases = ['doshin_office' => 'doshin', 'village' => 'chat', 'enemies' => 'consider', 'duel' => 'rumor', 'item' => 'inventory'];
开发者ID:BitLucid,项目名称:ninjawars,代码行数:10,代码来源:routes.php

示例12: empty

<?php

# The DOC_ROOT and APP_PATH constant have to happen in the actual app
# Document root, ex: /path/to/home/app.com/../ (uses ./ on CLI)
define('DOC_ROOT', empty($_SERVER['DOCUMENT_ROOT']) ? './' : realpath($_SERVER['DOCUMENT_ROOT']) . '/../');
# App path, ex: /path/to/home/app.com/
define('APP_PATH', realpath(dirname(__FILE__)) . '/');
# Environment
require_once DOC_ROOT . 'environment.php';
# Where is core located?
define('CORE_PATH', $_SERVER['DOCUMENT_ROOT'] . "/../core/");
# Load app configs
require APP_PATH . "/config/config.php";
require APP_PATH . "/config/feature_flags.php";
# Bootstrap
require CORE_PATH . "bootstrap.php";
# Routing
Router::$routes = array('/' => '/index', '/proposal' => '/index/p4');
# Match requested uri to any routes and instantiate controller
Router::init();
# Display environment details
require CORE_PATH . "environment-details.php";
开发者ID:nvarney,项目名称:dwa_prod,代码行数:22,代码来源:index.php

示例13: loadDefaultRoutes

 public function loadDefaultRoutes()
 {
     require CODE_ROOT_DIR . "config/routes.php";
     self::$routes = $routes;
 }
开发者ID:reinfire,项目名称:arfooo,代码行数:5,代码来源:Router.php

示例14: setRoutes

 public static function setRoutes()
 {
     self::$routes = explode('/', $_SERVER['REQUEST_URI']);
 }
开发者ID:Tidynar,项目名称:University,代码行数:4,代码来源:Router.php

示例15: tearDown

 /**
  * 
  */
 public function tearDown()
 {
     Router::$routes = array();
 }
开发者ID:joshdavey,项目名称:madeam,代码行数:7,代码来源:RouterTest.php


注:本文中的Router::routes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。