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


PHP Router::resourceMap方法代码示例

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


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

示例1: array

<?php

Router::mapResources(array('gifts', 'users'));
Router::resourceMap(array(array('action' => 'index', 'method' => 'GET', 'id' => false), array('action' => 'view', 'method' => 'GET', 'id' => true), array('action' => 'add', 'method' => 'POST', 'id' => false), array('action' => 'update', 'method' => 'PUT', 'id' => true), array('action' => 'signup', 'method' => 'POST', 'id' => false), array('action' => 'delete', 'method' => 'DELETE', 'id' => true)));
Router::parseExtensions();
require CAKE . 'Config' . DS . 'routes.php';
开发者ID:Rise-Up-Cambodia,项目名称:Android_Assignment_1,代码行数:6,代码来源:routes.php

示例2: array

 * different URLs to chosen controllers and their actions (functions).
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.Config
 * @since         CakePHP(tm) v 0.2.9
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
Router::resourceMap(array(array('action' => 'index', 'method' => 'GET', 'id' => false, 'ext' => 'json'), array('action' => 'view', 'method' => 'GET', 'id' => true), array('action' => 'index', 'method' => 'POST', 'id' => false), array('action' => 'edit', 'method' => 'PUT', 'id' => true), array('action' => 'delete', 'method' => 'DELETE', 'id' => true), array('action' => 'add', 'method' => 'POST', 'id' => true)));
Router::mapResources('aliases', array('id' => '[^/]*'));
Router::parseExtensions('xml', 'json');
/**
 * Here, we are connecting '/' (base path) to controller called 'Pages',
 * its action called 'display', and we pass a param to select the view file
 * to use (in this case, /app/View/Pages/home.ctp)...
 */
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
/**
 * ...and connect the rest of 'Pages' controller's URLs.
 */
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
/**
 * Load all plugin routes. See the CakePlugin documentation on
 * how to customize the loading of plugin routes.
开发者ID:byu-oit-appdev,项目名称:eamWS,代码行数:31,代码来源:routes.php

示例3: testResourceMap

 /**
  * Tests resourceMap as getter and setter.
  *
  * @return void
  */
 public function testResourceMap()
 {
     $default = Router::resourceMap();
     $exepcted = array(array('action' => 'index', 'method' => 'GET', 'id' => false), array('action' => 'view', 'method' => 'GET', 'id' => true), array('action' => 'add', 'method' => 'POST', 'id' => false), array('action' => 'edit', 'method' => 'PUT', 'id' => true), array('action' => 'delete', 'method' => 'DELETE', 'id' => true), array('action' => 'edit', 'method' => 'POST', 'id' => true));
     $this->assertEquals($default, $exepcted);
     $custom = array(array('action' => 'index', 'method' => 'GET', 'id' => false), array('action' => 'view', 'method' => 'GET', 'id' => true), array('action' => 'add', 'method' => 'POST', 'id' => false), array('action' => 'edit', 'method' => 'PUT', 'id' => true), array('action' => 'delete', 'method' => 'DELETE', 'id' => true), array('action' => 'update', 'method' => 'POST', 'id' => true));
     Router::resourceMap($custom);
     $this->assertEquals($custom, Router::resourceMap());
     Router::resourceMap($default);
 }
开发者ID:nabeelio,项目名称:CakePHP-Base,代码行数:15,代码来源:RouterTest.php

示例4: array

 * PHP 5
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.Config
 * @since         CakePHP(tm) v 0.2.9
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
Router::resourceMap();
Router::parseExtensions('json', 'xml');
/**
 * Here, we are connecting '/' (base path) to controller called 'Pages',
 * its action called 'display', and we pass a param to select the view file
 * to use (in this case, /app/View/Pages/home.ctp)...
 */
Router::connect('/', array('controller' => 'login', 'action' => 'login'));
Router::connect('/register/*', array('controller' => 'register', 'action' => 'register'));
/**
 * ...and connect the rest of 'Pages' controller's urls.
 */
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
Router::connect('/json/index/*', ['controller' => 'posts', 'action' => 'index']);
Router::connect('/json/register/*', ['controller' => 'posts', 'action' => 'register']);
/**
开发者ID:naddy095,项目名称:chalrahi-be,代码行数:31,代码来源:routes.php

示例5: array

 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.Config
 * @since         CakePHP(tm) v 0.2.9
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
/**
 * Here, we are connecting '/' (base path) to controller called 'Pages',
 * its action called 'display', and we pass a param to select the view file
 * to use (in this case, /app/View/Pages/home.ctp)...
 */
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
/**
 * ...and connect the rest of 'Pages' controller's URLs.
 */
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
/**
 * Load all plugin routes. See the CakePlugin documentation on
 * how to customize the loading of plugin routes.
 */
CakePlugin::routes();
/**
 * Configure REST API
 */
Router::resourceMap(array(array('controller' => 'products', 'action' => 'view', 'method' => 'GET', 'id' => false), array('controller' => 'products', 'action' => 'search', 'method' => 'GET', 'id' => false), array('controller' => 'products', 'action' => 'order', 'method' => 'POST', 'id' => false)));
Router::mapResources('products');
Router::parseExtensions();
/**
 * Load the CakePHP default routes. Only remove this if you do not want to use
 * the built-in default routes.
 */
require CAKE . 'Config' . DS . 'routes.php';
开发者ID:jtanveer,项目名称:sbuy,代码行数:31,代码来源:routes.php

示例6: testResourceMap

 /**
  * Tests resourceMap as getter and setter.
  *
  * @return void
  */
 public function testResourceMap()
 {
     $default = Router::resourceMap();
     $expected = array(array('action' => 'index', 'method' => 'GET', 'id' => FALSE), array('action' => 'view', 'method' => 'GET', 'id' => TRUE), array('action' => 'add', 'method' => 'POST', 'id' => FALSE), array('action' => 'edit', 'method' => 'PUT', 'id' => TRUE), array('action' => 'delete', 'method' => 'DELETE', 'id' => TRUE), array('action' => 'edit', 'method' => 'POST', 'id' => TRUE));
     $this->assertEquals($expected, $default);
     $custom = array(array('action' => 'index', 'method' => 'GET', 'id' => FALSE), array('action' => 'view', 'method' => 'GET', 'id' => TRUE), array('action' => 'add', 'method' => 'POST', 'id' => FALSE), array('action' => 'edit', 'method' => 'PUT', 'id' => TRUE), array('action' => 'delete', 'method' => 'DELETE', 'id' => TRUE), array('action' => 'update', 'method' => 'POST', 'id' => TRUE));
     Router::resourceMap($custom);
     $this->assertEquals(Router::resourceMap(), $custom);
     Router::resourceMap($default);
 }
开发者ID:mrbadao,项目名称:api-official,代码行数:15,代码来源:RouterTest.php

示例7: array

<?php

Router::connect('/api/:version/login', array('plugin' => 'Oxicode', 'controller' => 'Rest', 'action' => 'login', 'ext' => 'json'), array('version' => '1'));
Router::connect('/api/:version/:noun/*', array('plugin' => 'Oxicode', 'controller' => 'Rest', 'action' => 'disparador', 'ext' => 'json'), array('version' => '[1-2]'));
Router::mapResources('Oxicode.Rest', array('prefix' => 'api'));
Router::resourceMap(array(array('action' => 'login', 'method' => 'POST', 'id' => false)));
开发者ID:oxicode,项目名称:cakephp-modo-mantenimiento,代码行数:6,代码来源:routes.php

示例8: array

 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.Config
 * @since         CakePHP(tm) v 0.2.9
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
/**
 * Here, we are connecting '/' (base path) to controller called 'Pages',
 * its action called 'display', and we pass a param to select the view file
 * to use (in this case, /app/View/Pages/home.ctp)...
 */
Router::mapResources('fxchng');
Router::parseExtensions('json');
Router::resourceMap(array(array('controller' => 'categories', 'action' => 'index', 'method' => 'POST'), array('controller' => 'categories', 'action' => 'sub_category_items', 'method' => 'POST', 'id' => true), array('controller' => 'categories', 'action' => 'product_detail', 'method' => 'POST', 'id' => true), array('controller' => 'categories', 'action' => 'get_brands', 'method' => 'POST', 'id' => true), array('controller' => 'categories', 'action' => 'get_roles', 'method' => 'POST', 'id' => false), array('controller' => 'categories', 'action' => 'common_friend', 'method' => 'POST', 'id' => false), array('controller' => 'categories', 'action' => 'mutual_friend', 'method' => 'POST', 'user_fb_id' => true, 'ad_fb_id' => true), array('action' => 'update', 'method' => 'POST', 'id' => true)));
Router::connect('/', array('controller' => 'home', 'action' => 'index', 'home'));
/**
 * ...and connect the rest of 'Pages' controller's URLs.
 */
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
/**
 * Load all plugin routes. See the CakePlugin documentation on
 * how to customize the loading of plugin routes.
 */
CakePlugin::routes();
/**
 * Load the CakePHP default routes. Only remove this if you do not want to use
 * the built-in default routes.
 */
require CAKE . 'Config' . DS . 'routes.php';
开发者ID:riddhisoni1324,项目名称:cakephp_fxchng,代码行数:31,代码来源:routes.php


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