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


PHP ControllerCollection::match方法代碼示例

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


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

示例1: addRoutes

 protected function addRoutes(ControllerCollection $c)
 {
     $c->get('/users', 'admin')->bind('users');
     $c->match('/users/edit/{id}', 'edit')->assert('id', '\\d*')->bind('useredit');
     $c->match('/userfirst', 'first')->bind('userfirst');
     $c->post('/user/{action}/{id}', 'modify')->bind('useraction');
     $c->match('/profile', 'profile')->bind('profile');
     $c->get('/roles', 'viewRoles')->bind('roles');
 }
開發者ID:atiarda,項目名稱:bolt,代碼行數:9,代碼來源:Users.php

示例2: addRoutes

 protected function addRoutes(ControllerCollection $c)
 {
     $c->match('/file/edit/{namespace}/{file}', 'edit')->assert('file', '.+')->assert('namespace', '[^/]+')->value('namespace', 'files')->bind('fileedit')->after(function (Request $request, Response $response) {
         if ($request->isMethod('POST')) {
             $response->headers->set('X-XSS-Protection', '0');
         }
     });
     $c->match('/files/{namespace}/{path}', 'manage')->assert('namespace', '[^/]+')->assert('path', '.*')->value('namespace', 'files')->value('path', '')->bind('files');
 }
開發者ID:robbert-vdh,項目名稱:bolt,代碼行數:9,代碼來源:FileManager.php

示例3: connect

 public function connect(Application $app)
 {
     $post = new ControllerCollection(new Route());
     $post->match('/', "post.controller:index")->method('GET')->bind('listPosts');
     $post->match('/{id}', "post.controller:view")->method('GET|POST')->assert('id', '\\d+');
     $post->match('/new', "post.controller:form")->method('POST|GET')->bind('AddPost');
     $post->match('/update/{id}', "post.controller:update")->method('POST|GET')->bind('UpdatePost');
     $post->match('/destroy/{id}', "post.controller:destroy")->method('GET')->bind('DeletePost');
     return $post;
 }
開發者ID:anhnt36,項目名稱:admin_Si,代碼行數:10,代碼來源:PostControllerProvider.php

示例4: connect

 public function connect(Application $app)
 {
     $user = new ControllerCollection(new Route());
     $user->get('/', "user.controller:show");
     $user->match('/login', "user.controller:login")->method('POST|GET');
     $user->match('/show', "user.controller:show")->method('GET|POST');
     $user->match('/add', "user.controller:add")->method('POST|GET');
     $user->match('/logout', "user.controller:logout")->method('GET');
     return $user;
 }
開發者ID:anhnt36,項目名稱:admin_Si,代碼行數:10,代碼來源:UserControllerProvider.php

示例5: addRoutes

 protected function addRoutes(ControllerCollection $c)
 {
     $c->get('/about', 'about')->bind('about');
     $c->get('/checks', 'checks')->bind('checks');
     $c->get('/clearcache', 'clearCache')->bind('clearcache');
     $c->get('/', 'dashboard')->bind('dashboard');
     $c->get('/omnisearch', 'omnisearch')->bind('omnisearch-results');
     $c->match('/prefill', 'prefill')->bind('prefill');
     $c->match('/tr/{domain}/{tr_locale}', 'translation')->bind('translation')->assert('domain', 'messages|contenttypes|infos')->value('domain', 'messages')->value('tr_locale', $this->app['locale']);
 }
開發者ID:d-m-,項目名稱:bolt,代碼行數:10,代碼來源:General.php

示例6: addRoutes

 protected function addRoutes(ControllerCollection $c)
 {
     $c->method('GET|POST');
     $c->match('/editcontent/{contenttypeslug}/{id}', 'edit')->bind('editcontent')->assert('id', '\\d*')->value('id', '');
     $c->get('/overview/{contenttypeslug}', 'overview')->bind('overview');
     $c->get('/relatedto/{contenttypeslug}/{id}', 'related')->bind('relatedto')->assert('id', '\\d*');
 }
開發者ID:atiarda,項目名稱:bolt,代碼行數:7,代碼來源:Records.php

示例7: addRoutes

 protected function addRoutes(ControllerCollection $c)
 {
     $c->get('/login', 'getLogin')->bind('login');
     $c->post('/login', 'postLogin')->bind('postLogin');
     $c->match('/logout', 'logout')->bind('logout');
     $c->get('/resetpassword', 'resetPassword')->bind('resetpassword');
 }
開發者ID:nuffer,項目名稱:bolt,代碼行數:7,代碼來源:Authentication.php

示例8: match

 public function match($pattern, $to = null)
 {
     if ($this->defaultControllerClass && is_string($to) && method_exists($this->defaultControllerClass, $to)) {
         $to = [$this->defaultControllerClass, $to];
     }
     return parent::match($pattern, $to);
 }
開發者ID:nectd,項目名稱:nectd-web,代碼行數:7,代碼來源:ControllerCollection.php

示例9: connect

 public function connect(Application $app)
 {
     $controllers = new ControllerCollection();
     $controllers->match('/{slug}', function (Application $app, Request $request, $username) {
         return $this->getProcessor($request)->execute()->getResponse();
     });
     return $controllers;
 }
開發者ID:nlegoff,項目名稱:statme,代碼行數:8,代碼來源:User.php

示例10: addRoutes

 protected function addRoutes(ControllerCollection $controllers)
 {
     $controllers->post('/api/users', array($this, 'newAction'));
     $controllers->get('/api/users/{name}', array($this, 'showAction'))->bind('api_users_show');
     $controllers->get('/api/users', array($this, 'listAction'));
     $controllers->put('/api/users/{name}', array($this, 'updateAction'));
     $controllers->delete('/api/users/{name}', array($this, 'deleteAction'));
     $controllers->match('api/users/{name}', array($this, 'updateAction'))->method('PATCH');
 }
開發者ID:rllmwm,項目名稱:forbiddencat,代碼行數:9,代碼來源:UserController.php

示例11: process

 /**
  * Register the method $controllerName as controller for the given method and uri.
  *
  * @param \Silex\ControllerCollection $cc
  * @param string                      $controllerName Fully qualified method name of the controller
  * @return \Silex\Controller
  */
 public function process(ControllerCollection $cc, $controllerName)
 {
     $controller = $cc->match($this->uri, $controllerName);
     if ('MATCH' != ($method = strtoupper($this->method))) {
         // limit to configured method(s)
         $controller = $controller->method($method);
     }
     return $controller;
 }
開發者ID:jsmith07,項目名稱:silex-annotation-provider,代碼行數:16,代碼來源:Request.php

示例12: addRoutes

 protected function addRoutes(ControllerCollection $c)
 {
     $c->method('GET|POST');
     $c->get('/list/{contenttypeslug}', 'overview')->bind('overview');
     $c->match('/add-edit/{contenttypeslug}/{id}', 'edit')->bind('editcontent')->value('id', '');
     $c->get('/delete/{contenttypeslug}/{id}', 'delete')->bind('deletecontent');
     $c->post('/content-{action}/{contenttypeslug}/{id}', 'modify')->bind('contentaction');
     $c->get('/relatedto/{contenttypeslug}/{id}', 'related')->bind('relatedto');
 }
開發者ID:blimp-php,項目名稱:blimp-client-bolt,代碼行數:9,代碼來源:BlimpRecords.php

示例13: connect

 public function connect(Application $app)
 {
     $controller = new ControllerCollection($app['route_factory']);
     $controller->match('/', function () use($app) {
         if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
             $browsersLocale = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
             if (in_array($browsersLocale, array('en', 'fr'))) {
                 $app['locale'] = $browsersLocale;
             }
         }
         return $app->redirect($app['url_generator']->generate('homepage', array('locale' => $app['locale'])));
     })->bind('home');
     $controller->match('/{locale}/', function () use($app) {
         // Get all reports
         $reports = $app['repository.report']->findAll();
         return $app['twig']->render('Report/list.html.twig', array('reports' => $reports));
     })->bind('homepage');
     return $controller;
 }
開發者ID:rev42,項目名稱:revpdf,代碼行數:19,代碼來源:Root.php

示例14: match

 public function match($pattern, $to = null)
 {
     $controller = parent::match($pattern, $to);
     $route = $controller->getRoute();
     if (!$route instanceof CorsRoute) {
         throw new \RuntimeException('The generated route does not have the proper type, did you register the service provider properly?');
     }
     $route->setControllerCollection($this);
     return $controller;
 }
開發者ID:trademachines,項目名稱:silex-cors-provider,代碼行數:10,代碼來源:CorsControllerCollection.php

示例15: match

 /**
  * This uses default class/method if not provided
  *
  * {@inheritdoc}
  */
 public function match($pattern, $to = null)
 {
     if (!$this->defaultControllerClass) {
         return parent::match($pattern, $to);
     }
     if ($to === null && $this->defaultControllerMethod) {
         $to = [$this->defaultControllerClass, $this->defaultControllerMethod];
     } elseif (is_string($to) && Str::startsWith($to, '::')) {
         $to = [$this->defaultControllerClass, substr($to, 2)];
     }
     return parent::match($pattern, $to);
 }
開發者ID:gmo,項目名稱:common,代碼行數:17,代碼來源:ControllerCollection.php


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