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


PHP Router::connect方法代码示例

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


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

示例1: connect

 /**
  * Conecta una nueva ruta interpretada al enrutador
  *
  *
  * @param string $route
  * @param array $defaults
  * @param array $options
  */
 function connect($route, $defaults = array(), $options = array())
 {
     $self = I18nRouter::getInstance();
     $route = $self->interpretUrl($route);
     //pr($route);
     Router::connect($route, $defaults, $options);
 }
开发者ID:roae,项目名称:hello-world,代码行数:15,代码来源:i18n_router.php

示例2: startTest

 public function startTest()
 {
     Configure::write('Cache.disable', false);
     Router::reload();
     Router::connect('/:controller/:action/*', array(), array('routeClass' => 'SluggableRoute', 'models' => array('RouteTest')));
     $this->RouteTest = ClassRegistry::init('RouteTest');
 }
开发者ID:omnuvito,项目名称:i18n,代码行数:7,代码来源:BenchmarkTest.php

示例3: version

 /**
  * Get or set version info (DB)
  *
  * @param string $extension
  * @param string $newVersion
  */
 public static function version($extension = 'core', $newVersion = null)
 {
     if (SlConfigure::read('Sl.installPending')) {
         return SlConfigure::read('Sl.version');
     }
     if (!SlConfigure::read('Mirror.version')) {
         App::import('Core', 'ConnectionManager');
         $db = @ConnectionManager::getDataSource('default');
         if (!$db->isConnected() || !in_array("{$db->config['prefix']}core_versions", $db->listSources())) {
             if (strpos(Sl::url(false), '/install') === false) {
                 Router::connect(Sl::url(false), array('controller' => 'install'));
             }
             return;
         }
         App::import('Core', 'ClassRegistry');
         ClassRegistry::init('Version')->refreshMirror();
     }
     if ($newVersion) {
         $versionModel = ClassRegistry::init('Version');
         $id = $versionModel->field('Version.id', array('Version.name' => $extension));
         $versionModel->create();
         return $versionModel->save(array('id' => $id, 'name' => $extension, 'version' => $newVersion));
     }
     return SlConfigure::read("Mirror.version.{$extension}");
 }
开发者ID:sandulungu,项目名称:StarLight,代码行数:31,代码来源:sl.php

示例4: testPasRedirect

 /**
  * testPasRedirect
  *
  * @return void
  */
 public function testPasRedirect()
 {
     Router::connect('/:controller/:action/*');
     $this->Controller->action = 'index';
     $this->Pas->pasRedirect(array('action' => 'index'));
     $expected = array('action' => 'index');
     $this->assertEqual($expected, $this->Controller->redirectUrl);
     // Test for redirect status and whether exit or not
     $this->Pas->pasRedirect(array('action' => 'index'), 302, false);
     $expected = array('action' => 'index');
     $this->assertEqual($expected, $this->Controller->redirectUrl);
     $this->assertEqual(302, $this->Controller->redirectStatus);
     $this->assertEqual(false, $this->Controller->exit);
     $this->Controller->request->params['named'] = array('page' => 1);
     $this->Controller->request->query = array('foo' => 'bar');
     $this->Pas->pasRedirect('/posts/index');
     $expected = array('plugin' => false, 'controller' => 'posts', 'action' => 'index', 'page' => 1, '?' => array('foo' => 'bar'));
     $this->assertEqual($expected, $this->Controller->redirectUrl);
     $this->Pas->pasRedirect('/posts/index/page:2?foo=baz');
     $expected = array('plugin' => false, 'controller' => 'posts', 'action' => 'index', 'page' => 2, '?' => array('foo' => 'baz'));
     $this->assertEqual($expected, $this->Controller->redirectUrl);
     // Test for named and query
     $this->Pas->pasRedirect(array('action' => 'index'));
     $expected = array('action' => 'index', 'page' => 1, '?' => array('foo' => 'bar'));
     $this->assertEqual($expected, $this->Controller->redirectUrl);
     // Test for overriding
     $expected = array('action' => 'index', 'page' => 2, '?' => array('foo' => 'baz'));
     $this->Pas->pasRedirect(array('action' => 'index', 'page' => 2, '?' => array('foo' => 'baz')));
     $this->assertEqual($expected, $this->Controller->redirectUrl);
 }
开发者ID:tsmsogn,项目名称:Pas,代码行数:35,代码来源:PasComponentTest.php

示例5: setUp

 function setUp()
 {
     Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
     Router::parse('/');
     $this->Controller =& ClassRegistry::init('Controller');
     $this->Controller->Component =& ClassRegistry::init('Component');
     $this->Controller->Toolbar =& ClassRegistry::init('TestToolBarComponent', 'Component');
 }
开发者ID:TomMaher,项目名称:umambo,代码行数:8,代码来源:toolbar.test.php

示例6: setUp

 /**
  * set Up test case
  *
  * @return void
  **/
 function setUp()
 {
     Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
     Router::parse('/');
     $this->Controller =& ClassRegistry::init('Controller');
     $this->View =& new DebugView($this->Controller, false);
     $this->_debug = Configure::read('debug');
 }
开发者ID:afzet,项目名称:cake-cart,代码行数:13,代码来源:debug.test.php

示例7: connect

 function connect($route, $default = array(), $params = array())
 {
     parent::connect($route, $default, $params);
     if ($route == '/') {
         $route = '';
     }
     parent::connect('/:locale', $default, array_merge(array('locale' => '[a-z]{3}'), $params));
 }
开发者ID:nicoeche,项目名称:Finalus,代码行数:8,代码来源:routes.php

示例8: setUp

 /**
  * set Up test case
  *
  * @return void
  **/
 public function setUp()
 {
     parent::setUp();
     Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
     Router::parse('/');
     $this->Controller = new Controller();
     $this->View = new DebugView($this->Controller, false);
 }
开发者ID:omusico,项目名称:RentSquare,代码行数:13,代码来源:DebugViewTest.php

示例9: connect

 /**
  * This method tried to mimic the original `Router::connect` adding some
  * extra params and handling the insertion of necessary options to it.
  *
  * @param string $name A unique name for this route.
  * @param string $route A string describing the template of the route.
  * @param array $defaults An array describing the default route parameters.
  *                        These parameters will be used by default and can
  *                        supply routing parameters that are not dynamic.
  * @param array $options An array matching the named elements in the route
  *                       to regular expressions which that element should
  *                       match. Also contains additional parameters such as
  *                       which routed parameters should be shifted into the
  *                       passed arguments and supplying patterns for routing
  *                       parameters.
  * @return array Array of routes.
  */
 public static function connect($name, $route, $defaults = array(), $options = array())
 {
     $extra = array('routeClass' => 'PowerRoute');
     if (!empty($name)) {
         $extra['routeName'] = $name;
     }
     return Router::connect($route, $defaults, array_merge($extra, $options));
 }
开发者ID:eberfreitas,项目名称:cakephp-power-router,代码行数:25,代码来源:PowerRouter.php

示例10: registerRoutes

 public function registerRoutes()
 {
     $routes = new RouteCollection();
     foreach ($this->routerConfiguration as $routeName => $singleRoute) {
         $routes->add($routeName, new Route($singleRoute['path'], $singleRoute['defaults']));
         $singleRouteCakePath = preg_replace("/(\\{)(\\w+)(\\})/", ":\$2", $singleRoute['path']);
         Router::connect($singleRouteCakePath, $singleRoute['defaults']);
     }
     $this->routes = $routes;
 }
开发者ID:piotrpasich,项目名称:cakephp-symfony-router,代码行数:10,代码来源:SymfonyRouter.php

示例11: setUp

 /**
  * Setup
  *
  * @return void
  */
 public function setUp()
 {
     Configure::write('App.linkMap', array('blogSlug' => array('preset' => array('controller' => 'blog_posts', 'action' => 'view'), 'alias' => 'BlogPost', 'fieldMap' => array('id' => '{alias}.id', 'slug' => '{alias}.slug', 'categorySlug' => 'Category.slug'), 'titleField' => 'BlogPost.title')));
     $null = null;
     $this->View = new View(null);
     $this->View->Helpers->load('Html');
     $this->Link = new LinkHelper($this->View);
     Router::reload();
     Router::connect('/article/:categorySlug/:slug-:id', array('controller' => 'blog_posts', 'action' => 'view'));
 }
开发者ID:burzum,项目名称:cakephp-bz-utils,代码行数:15,代码来源:LinkHelperTest.php

示例12: startTest

 /**
  * setUp
  *
  * @return void
  **/
 function startTest()
 {
     Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
     Router::parse('/');
     $this->Asset =& new AssetHelper();
     $this->Asset->Html =& new HtmlHelper();
     $this->Controller =& ClassRegistry::init('Controller');
     if (isset($this->_debug)) {
         Configure::write('debug', $this->_debug);
     }
 }
开发者ID:awd,项目名称:assets,代码行数:16,代码来源:asset.test.php

示例13: setUp

 /**
  * setUp
  *
  * @return void
  **/
 function setUp()
 {
     Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
     Router::parse('/');
     $this->Toolbar =& new ToolbarHelper(array('output' => 'DebugKit.FirePhpToolbar'));
     $this->Toolbar->FirePhpToolbar =& new FirePhpToolbarHelper();
     $this->Controller =& ClassRegistry::init('Controller');
     if (isset($this->_debug)) {
         Configure::write('debug', $this->_debug);
     }
 }
开发者ID:afzet,项目名称:cake-cart,代码行数:16,代码来源:fire_php_toobar.test.php

示例14: startTest

 function startTest()
 {
     Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
     Router::parse('/');
     $this->GpsForm =& new GpsFormHelper();
     $this->GpsForm->MockBackend = new MockBackendHelper();
     $this->Controller =& ClassRegistry::init('Controller');
     if (isset($this->_debug)) {
         Configure::write('debug', $this->_debug);
     }
 }
开发者ID:slywalker,项目名称:mobile_kit,代码行数:11,代码来源:gps_form.test.php

示例15: setUp

 /**
  * setUp
  *
  * @return void
  **/
 public function setUp()
 {
     parent::setUp();
     Router::connect('/:controller/:action');
     Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
     Router::parse('/');
     $this->Controller = new Controller($this->getMock('CakeRequest'), new CakeResponse());
     $this->View = new View($this->Controller);
     $this->Toolbar = new ToolbarHelper($this->View, array('output' => 'DebugKit.FirePhpToolbar'));
     $this->Toolbar->FirePhpToolbar = new FirePhpToolbarHelper($this->View);
     $this->firecake = FireCake::getInstance();
 }
开发者ID:cc2i,项目名称:calibrephp,代码行数:17,代码来源:FirePhpToolbarHelperTest.php


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