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


PHP Router::any方法代码示例

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


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

示例1: routeError

 /**
  * Add a route for error handling
  * @param string $errorType the type of error to route
  * @param string $actionName used to define the action to route to
  */
 public function routeError($errorType, $actionName)
 {
     if (true === is_numeric($errorType)) {
         $errorRouteId = $this->routeId[$errorType];
     } elseif (class_exists($errorType) && is_subclass_of($errorType, '\\Exception')) {
         $errorRouteId = preg_replace('/\\W/', '', self::ERROR_CUSTOM_ROUTE_ID . $errorType);
         $this->customErrorRoutes[] = $errorType;
         $this->routeId[$errorType] = $errorRouteId;
     } else {
         throw new Exception('Unable to add error route for %s', 0, $errorType);
     }
     $this->_router->any($errorRouteId, array('as' => $errorRouteId, 'to' => $actionName));
     return $this;
 }
开发者ID:sohoa,项目名称:framework,代码行数:19,代码来源:ErrorHandler.php

示例2: exit

            exit('The application environment is not set correctly.');
    }
}
//initiate config
new \core\config();
//create alias for Router
use core\router, helpers\url;
//define routes
Router::any('admin', '\\controllers\\admin\\admin@index');
Router::any('admin/login', '\\controllers\\admin\\auth@login');
Router::any('admin/logout', '\\controllers\\admin\\auth@logout');
Router::any('admin/users', '\\controllers\\admin\\users@index');
Router::any('admin/users/add', '\\controllers\\admin\\users@add');
Router::any('admin/users/edit/(:num)', '\\controllers\\admin\\users@edit');
Router::any('admin/posts', '\\controllers\\admin\\posts@index');
Router::any('admin/posts/add', '\\controllers\\admin\\posts@add');
Router::any('admin/posts/edit/(:num)', '\\controllers\\admin\\posts@edit');
Router::any('admin/posts/delete/(:num)', '\\controllers\\admin\\posts@delete');
Router::any('admin/cats', '\\controllers\\admin\\cats@index');
Router::any('admin/cats/add', '\\controllers\\admin\\cats@add');
Router::any('admin/cats/edit/(:num)', '\\controllers\\admin\\cats@edit');
Router::any('admin/cats/delete/(:num)', '\\controllers\\admin\\cats@delete');
Router::any('', '\\controllers\\blog@index');
Router::any('category/(:any)', '\\controllers\\blog@cat');
Router::any('(:any)', '\\controllers\\blog@post');
//if no route found
Router::error('\\core\\error@index');
//turn on old style routing
Router::$fallback = false;
//execute matched routes
Router::dispatch();
开发者ID:fabioassuncao,项目名称:build-a-blog,代码行数:31,代码来源:index.php

示例3: test_optional_parameter_in_class_routes

 /**
  * @group issues
  * @ticket 37
  **/
 public function test_optional_parameter_in_class_routes()
 {
     $r = new Router();
     $r->any('/optional/*', 'Respect\\Rest\\MyOptionalParamRoute');
     $response = $r->dispatch('get', '/optional')->response();
     $this->assertEquals('John Doe', (string) $response);
 }
开发者ID:zhulianhai,项目名称:Rest,代码行数:11,代码来源:OldRouterTest.php

示例4:

Router::any('applications', '\\controllers\\applications@create');
Router::any('locations', '\\controllers\\locations@create');
Router::any('apply', '\\controllers\\apply@index');
Router::any('apply_submit', '\\controllers\\apply@submit');
Router::any('changepassword', '\\controllers\\changepassword@index');
Router::any('changepassword_submit', '\\controllers\\changepassword@submit');
Router::any('registerBoardMember', '\\controllers\\registerAdmin@index');
Router::any('registerBoardMember_submit', '\\controllers\\registerAdmin@submit');
Router::any('draftBoard', '\\controllers\\draftBoard@index');
Router::any('draftBoard_wishlist', '\\controllers\\draftBoard@wishlist');
Router::any('draftBoard_search', '\\controllers\\draftBoard@search');
Router::any('draftBoard_main', '\\controllers\\draftBoard@draftBoard');
Router::any('trip_analytics', '\\controllers\\trip_analytics@create');
Router::any('application_analytics', '\\controllers\\application_analytics@create');
//ajax routes
Router::any('ajax/applicantSearch', '\\controllers\\ajax@applicantSearch');
Router::any('ajax/applicantAnswers', '\\controllers\\ajax@applicantAnswers');
Router::any('ajax/checkTurn', '\\controllers\\ajax@checkTurn');
Router::any('ajax/draft', '\\controllers\\ajax@draft');
Router::any('ajax/updateTurn', '\\controllers\\ajax@updateTurn');
Router::any('ajax/getDrafted', '\\controllers\\ajax@getDrafted');
Router::any('ajax/startDraft', '\\controllers\\ajax@beginDraft');
Router::any('ajax/finalizeDraft', '\\controllers\\ajax@finalizeDraft');
Router::any('ajax/getDraftOrder', '\\controllers\\ajax@getDraftOrder');
//if no route found
Router::error('\\core\\error@index');
//turn on old style routing
Router::$fallback = false;
//execute matched routes
Router::dispatch();
// debugger
开发者ID:rlh5z6,项目名称:MAB_draft_application,代码行数:31,代码来源:index.php

示例5:

<?php

Router::any('/', 'HomeController:index');
//
// Default hook routes.
//
Router::mount('/', 'Hook\\Application\\Routes');
开发者ID:endel,项目名称:hook-framework,代码行数:7,代码来源:routes.php

示例6: Router

 function test_single_last_param2()
 {
     $r = new Router();
     $args = array();
     $r->any('/documents/**', function ($documentsPath) use(&$args) {
         $args = func_get_args();
     });
     $r->dispatch('get', '/documents/foo/bar')->response();
     $this->assertEquals(array(array('foo', 'bar')), $args);
 }
开发者ID:nickl-,项目名称:Rest,代码行数:10,代码来源:RouterTest.php

示例7:

Router::any('admin/cities/add', '\\controllers\\admin\\cities@add');
Router::any('admin/cities/edit/(:num)', '\\controllers\\admin\\cities@edit');
Router::any('admin/cities/delete/(:num)', '\\controllers\\admin\\cities@delete');
Router::any('admin/permissions', '\\controllers\\admin\\permissions@index');
Router::any('admin/permissions/add', '\\controllers\\admin\\permissions@add');
Router::any('admin/permissions/edit/(:num)', '\\controllers\\admin\\permissions@edit');
Router::any('admin/permissions/delete/(:num)', '\\controllers\\admin\\permissions@delete');
Router::any('admin/archive', '\\controllers\\admin\\archive@index');
Router::any('admin/search', '\\controllers\\admin\\search@index');
Router::any('admin/pick', '\\controllers\\admin\\pick@index');
Router::any('admin/root', '\\controllers\\admin\\root@index');
Router::any('admin/root/add', '\\controllers\\admin\\root@add');
Router::any('admin/root/edit/(:num)', '\\controllers\\admin\\root@edit');
Router::any('admin/root/delete/(:num)', '\\controllers\\admin\\root@delete');
Router::any('admin/login', '\\controllers\\admin\\auth@login');
Router::any('admin/logout', '\\controllers\\admin\\auth@logout');
Router::any('', '\\controllers\\orders@index');
Router::any('/view/(:num)', '\\controllers\\orders@view');
Router::any('/edit/(:num)', '\\controllers\\orders@edit');
Router::any('search', '\\controllers\\search@index');
Router::any('pick', '\\controllers\\pick@index');
Router::any('faq', '\\controllers\\faq@index');
Router::any('message/send', '\\controllers\\orders@send_message');
Router::any('login', '\\controllers\\auth@login');
Router::any('logout', '\\controllers\\auth@logout');
//if no route found
Router::error('\\core\\error@index');
//turn on old style routing
Router::$fallback = false;
//execute matched routes
Router::dispatch();
开发者ID:alcounit,项目名称:franchAdmin,代码行数:31,代码来源:index.php

示例8: Router

 /**
  * Unit test for Commit: 3e8d536
  *
  * Catchall route called with / only would not get passed a parameter
  * to the callback function.
  */
 function test_catchall_on_root_call_should_get_callback_parameter()
 {
     $r = new Router();
     $args = array();
     $r->any('/**', function ($documentsPath) use(&$args) {
         $args = func_get_args();
     });
     $r->dispatch('get', '/')->response();
     $this->assertTrue(\is_array($args[0]));
 }
开发者ID:ricardobelo,项目名称:palestra-escalabilidade,代码行数:16,代码来源:RouterTest.php

示例9:

Router::get(['/image/{params}/{imagePath}', 'rules' => ['imagePath' => '[/\\a-z0-9_-]+', 'params' => '[a-z0-9-]+'], 'as' => 'imagefly'], 'Ivliev\\Imagefly\\ImageflyController@getIndex');
Router::get(['/{page?}', 'rules' => ['page' => '[a-z0-9_-]+'], 'as' => 'front.page'], 'Front\\Pages@getPage');
/**
 * Ajax
 */
/**
 * Тесты
 */
Router::get(['/Test', 'as' => 'front.test'], 'Front\\Pages@getTest');
Router::get(['/ImageTest/{imagePath}', 'rules' => ['imagePath' => '[/\\a-z0-9_-]+'], 'as' => 'front.test.image'], 'Test\\Imagefly@getImageTest');
Router::get(['/ImageTest2', 'as' => 'front.image.2'], 'Test\\Imagefly@getTest2');
Router::get(['/ImageTest3', 'as' => 'front.image.3'], 'Test\\Imagefly@getTest3');
Router::any(['/TestLang', 'as' => 'test.lang'], 'Test\\I18nTest@anyLang');
Router::any(['/Tests', 'as' => 'test.index'], 'Test\\I18nTest@anyIndex');
Router::any(['/TestLangRoute', 'as' => 'test.langroute'], 'Test\\I18nTest@anyTestLangRoute');
Router::any(['/TestNestedSets', 'as' => 'test.nestedsets'], 'Test\\NestedSets@anyIndex');
Router::any(['/TestFaker', 'as' => 'test.faker'], 'Test\\FakerTest@anyIndex');
Router::any(['/TestFaker2', 'as' => 'test.faker2'], 'Test\\FakerTest@anyIndex2');
Router::any(['/TestWord', 'as' => 'test.word'], 'Test\\WordTranslate@anyIndex');
Router::any(['/TestWidget', 'as' => 'test.widget'], 'Test\\Widget@anyIndex');
Router::any(['/TestLangChange', 'rules' => ['page' => '[a-z0-9_-]+'], 'as' => 'test.lang.change'], 'Test\\I18nTest@anyChangeLang');
Router::any(['/TestQuiz', 'rules' => ['id' => '[0-9]+'], 'as' => 'test.quiz.change'], 'Test\\Quiz\\Test@anyIndex');
Router::any(['/TestQuizResult', 'rules' => ['id' => '[0-9]+'], 'as' => 'test.result'], 'Test\\Quiz\\Test@anyResult');
//Router::get(['/test', 'as' => 'front.getTest'],'Front\Main@getTest');
//Router::any(['/test2', 'as' => 'front.anyTest'],'Front\Main@anyTest2');
//Router::get(['/API/Mobile/JSON/V1/confirmFriendship', 'as' => 'confirmFriendship'],'Api\Mobile\JSON\V1\Greeting@postConfirmFriendship');
Router::any(['/viewTest', 'as' => 'test.viewTests.index'], 'Test\\ViewTests@anyIndex');
Router::any(['/withLayout', 'as' => 'test.viewTests.WithLayout'], 'Test\\ViewTests@anyWithLayout');
Router::any(['/users/{id?}', 'rules' => ['id' => '[0-9]+'], 'as' => 'test.routeTests.users'], 'Test\\RouteTests@anyContents');
Router::any(['/users/list/{status?}/{page?}', 'rules' => ['status' => '[a-zа-я]+', 'page' => '[0-9]+'], 'as' => 'test.routeTests.usersList'], 'Test\\RouteTests@anyUsersList');
开发者ID:ArmSALArmy,项目名称:Banants,代码行数:30,代码来源:front.php

示例10:

Router::any(['/Admin/Articles/Edit/{id?}', 'rules' => ['id' => '[0-9]+'], 'as' => 'back.articles.edit'], 'Back\\Articles@anyEdit');
Router::get(['/Admin/Articles/Delete/{id?}', 'rules' => ['id' => '[0-9]+'], 'as' => 'back.articles.delete'], 'Back\\Articles@getDelete');
Router::get(['/Admin/Categories', 'as' => 'back.categories.list'], 'Back\\Categories@getList');
//Router::any(['/Admin/Categories/Add', 'as' => 'back.categories.add'],'Back\Categories@anyAdd');
Router::any(['/Admin/Categories/Save', 'as' => 'back.categories.save'], 'Back\\Categories@anySaveSorting');
Router::any(['/Admin/Categories/Edit/{id?}', 'rules' => ['id' => '[0-9]+'], 'as' => 'back.categories.edit'], 'Back\\Categories@anyEdit');
Router::get(['/Admin/Entities', 'as' => 'back.entities.list'], 'Back\\Entities@getList');
Router::any(['/Admin/Entities/Add', 'as' => 'back.entities.add'], 'Back\\Entities@anyAdd');
Router::any(['/Admin/Entities/Edit/{id?}', 'rules' => ['id' => '[0-9]+'], 'as' => 'back.entities.edit'], 'Back\\Entities@anyEdit');
Router::get(['/Admin/Entities/Delete/{id?}', 'rules' => ['id' => '[0-9]+'], 'as' => 'back.entities.delete'], 'Back\\Entities@getDelete');
Router::get(['/Admin/Languages', 'as' => 'back.languages.list'], 'Back\\Languages@getList');
Router::any(['/Admin/Languages/Add', 'as' => 'back.languages.add'], 'Back\\Languages@anyAdd');
Router::any(['/Admin/Languages/Edit/{id?}', 'rules' => ['id' => '[0-9]+'], 'as' => 'back.languages.edit'], 'Back\\Languages@anyEdit');
Router::get(['/Admin/Languages/Delete/{id?}', 'rules' => ['id' => '[0-9]+'], 'as' => 'back.languages.delete'], 'Back\\Languages@getDelete');
Router::post(['/Admin/Languages/Image/Delete', 'as' => 'back.languages.image.delete'], 'Back\\Languages@postImageDelete');
Router::get(['/Admin/Settings', 'as' => 'back.settings'], 'Back\\Settings@getGroups');
Router::get(['/Admin/Settings/{alias?}', 'rules' => ['status' => '[a-zA-Z]+'], 'as' => 'back.settings.list'], 'Back\\Settings@getList');
Router::any(['/Admin/Settings/Edit/{id?}', 'rules' => ['id' => '[0-9]+'], 'as' => 'back.settings.edit'], 'Back\\Settings@anyEdit');
Router::get(['/Admin/Menus/List/{id?}', 'rules' => ['id' => '[0-9]+'], 'as' => 'back.menus.list'], 'Back\\Menus@getList');
Router::any(['/Admin/Menus/Save', 'as' => 'back.menus.save'], 'Back\\Menus@anySaveSorting');
Router::any(['/Admin/Menus/Add/{id?}', 'as' => 'back.menus.add'], 'Back\\Menus@anyAdd');
Router::any(['/Admin/Menus/Edit/{id?}', 'rules' => ['id' => '[0-9]+'], 'as' => 'back.menus.edit'], 'Back\\Menus@anyEdit');
Router::get(['/Admin/Menus/Delete/{id?}', 'rules' => ['id' => '[0-9]+'], 'as' => 'back.menus.delete'], 'Back\\Menus@getDelete');
Router::post(['/Admin/Menus/Image/Delete', 'as' => 'back.menus.image.delete'], 'Back\\Menus@postImageDelete');
Router::any(['/Admin/Quiz', 'as' => 'back.quiz'], 'Back\\Quiz@anyIndex');
Router::get(['/Admin/Team/List/{id?}', 'rules' => ['id' => '[0-9]+'], 'as' => 'back.teams.list'], 'Back\\Teams@getList');
Router::any(['/Admin/Player/Add/{id?}', 'rules' => ['id' => '[0-9]+'], 'as' => 'back.player.add'], 'Back\\Players@anyAdd');
Router::any(['/Admin/Player/Edit/{id?}', 'rules' => ['id' => '[0-9]+'], 'as' => 'back.player.edit'], 'Back\\Players@anyEdit');
/**
 * Тесты
 */
开发者ID:ArmSALArmy,项目名称:Banants,代码行数:31,代码来源:back.php


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