本文整理汇总了PHP中lithium\net\http\Router::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Router::get方法的具体用法?PHP Router::get怎么用?PHP Router::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lithium\net\http\Router
的用法示例。
在下文中一共展示了Router::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
$this->_routes = Router::get();
Router::reset();
Router::connect('/{:controller}/{:action}');
$this->subject = new Simple(array('request' => new Request(array('base' => '', 'env' => array('HTTP_HOST' => 'foo.local')))));
}
示例2: _saveCtrlContext
protected function _saveCtrlContext()
{
$this->_context['scope'] = Router::scope(false);
$this->_context['routes'] = Router::get();
$this->_context['scopes'] = Router::attached();
Router::reset();
}
示例3: setUp
public function setUp()
{
$this->_routes = Router::get();
Router::reset();
Router::connect('/{:controller}/{:action}');
$this->subject = new Simple();
}
示例4: setUp
/**
* Initialize test by creating a new object instance with a default context.
*/
public function setUp()
{
$this->_routes = Router::get();
Router::reset();
Router::connect('/{:controller}/{:action}/{:id}.{:type}');
Router::connect('/{:controller}/{:action}.{:type}');
$this->context = new MockRenderer(array('request' => new Request(array('base' => '', 'env' => array('HTTP_HOST' => 'foo.local'))), 'response' => new Response()));
$this->html = new Html(array('context' => &$this->context));
}
示例5: setUp
/**
* Initialize test by creating a new object instance with a default context.
*
* @return void
*/
public function setUp()
{
$this->_routes = Router::get();
Router::reset();
Router::connect('/{:controller}/{:action}/{:id}.{:type}');
Router::connect('/{:controller}/{:action}.{:type}');
$this->context = new MockHtmlRenderer();
$this->html = new Html(array('context' => &$this->context));
}
示例6: setUp
/**
* Initialize test by creating a new object instance with a default context.
*/
public function setUp()
{
$this->_routes = Router::get();
Router::reset();
Router::connect('/test', 'Test::index');
Router::connect('/test2', 'TestTwo::index');
$this->context = new MockRenderer(array('request' => new Request(array('url' => '/test', 'env' => array('HTTP_HOST' => 'foo.local'))), 'response' => new Response()));
$this->backend = new Backend(array('context' => &$this->context));
}
示例7: setUp
/**
* Initialize test by creating a new object instance with a default context.
*
* @return void
*/
public function setUp()
{
$this->_routes = Router::get();
Router::connect(null);
Router::connect('/{:controller}/{:action}/{:id}.{:type}', array('id' => null));
Router::connect('/{:controller}/{:action}');
$this->context = new MockFormRenderer();
$this->form = new Form(array('context' => $this->context));
}
示例8: all
/**
* Lists all connected routes to the router. This is a convenience
* alias for the `show()` method.
*
* Example:
* {{{
* li3 route
* li3 route all
* }}}
*
* Will return an output similar to:
*
* {{{
* Template Params
* -------- ------
* / {"controller":"pages","action":"view"}
* /pages/{:args} {"controller":"pages","action":"view"}
* /{:slug:[\w\-]+} {"controller":"posts","action":"show"}
* /{:controller}/{:action}/{:args} {"action":"index"}
* }}}
*
* @return void
*/
public function all()
{
$routes = Router::get();
$columns = array(array('Template', 'Params'), array('--------', '------'));
foreach ($routes as $route) {
$info = $route->export();
$columns[] = array($info['template'], json_encode($info['params']));
}
$this->columns($columns);
}
示例9: setUp
public function setUp()
{
$this->_routes = Router::get();
Router::reset();
Router::connect('/{:controller}/{:action}/page/{:page:[0-9]+}');
$request = new Request();
$request->params = array('controller' => 'posts', 'action' => 'index');
$request->persist = array('controller');
$this->context = new MockRenderer(compact('request'));
$this->pagination = new Pagination(array('context' => $this->context));
}
示例10: setUp
/**
* Initialize test by creating a new object instance with a default context.
*/
public function setUp()
{
$this->_routes = Router::get();
Router::reset();
Router::connect('/{:controller}/{:action}/{:id}.{:type}', array('id' => null));
Router::connect('/{:controller}/{:action}/{:args}');
$request = new Request();
$request->params = array('controller' => 'posts', 'action' => 'index');
$request->persist = array('controller');
$this->context = new MockFormRenderer(compact('request'));
$this->form = new Form(array('context' => $this->context));
$this->base = $this->context->request()->env('base') . '/';
}
示例11: setup
function setup()
{
// Route
$this->_routes = Router::get();
Router::reset();
Router::connect('/{:controller}/{:action}/{:id}.{:type}');
Router::connect('/{:controller}/{:action}.{:type}');
// Info
$this->account = sprintf('UA-%05d-X', rand(1, 99999));
// Tracking
Trackers::add('test', array('account' => $this->account, 'adapter' => 'GoogleAnalytics'));
// Context
$this->context = new MockHtmlRenderer(array('request' => new Request(array('base' => '', 'env' => array('HTTP_HOST' => 'foo.local'))), 'response' => new Response()));
// Analytics
$this->analytics = new Analytics(array('context' => &$this->context));
}
示例12: testRouteLoading
/**
* Test if the routes.php file is loaded correctly and the
* routes are connected to the router.
*/
public function testRouteLoading()
{
$this->assertEmpty(Router::get(null, true));
$command = new Route(array('routes' => $this->_config['routes']));
$this->assertCount(4, Router::get(null, true));
Router::reset();
$request = new Request();
$request->params['env'] = 'production';
$command = new Route(compact('request') + array('routes' => $this->_config['routes']));
$this->assertCount(2, Router::get(null, true));
}
示例13: testRouteLoading
/**
* Test if the routes.php file is loaded correctly and the
* routes are connected to the router.
*/
public function testRouteLoading()
{
$this->assertFalse(Router::get());
$command = new Route(array('routes' => $this->_config['routes']));
$this->assertEqual(4, count(Router::get()));
Router::reset();
$request = new Request();
$request->params['env'] = 'production';
$command = new Route(compact('request') + array('routes' => $this->_config['routes']));
$this->assertEqual(2, count(Router::get()));
}
示例14: setUp
public function setUp()
{
$this->_routes = Router::get();
Router::reset();
}
示例15: setDefaultRoute
public function setDefaultRoute()
{
$this->_routes = Router::get();
Router::reset();
Router::connect('/{:controller}/{:action}');
}