当前位置: 首页>>代码示例>>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;未经允许,请勿转载。