本文整理汇总了PHP中lithium\action\Dispatcher::config方法的典型用法代码示例。如果您正苦于以下问题:PHP Dispatcher::config方法的具体用法?PHP Dispatcher::config怎么用?PHP Dispatcher::config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lithium\action\Dispatcher
的用法示例。
在下文中一共展示了Dispatcher::config方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testPluginControllerLookupFail
public function testPluginControllerLookupFail()
{
Dispatcher::config(array('classes' => array('router' => __CLASS__)));
$this->expectException("/Controller `some_invalid_plugin.Controller` not found/");
Dispatcher::run(new Request(array('url' => '/plugin')));
}
示例2: array
* see the `Router` and `Route` classes.
*
* @see lithium\net\http\Router
* @see lithium\net\http\Route
*/
use lithium\net\http\Router;
use lithium\core\Environment;
use lithium\action\Dispatcher;
// Set the evironment
if ($_SERVER['HTTP_HOST'] == 'li3bootstrap.dev.local' || $_SERVER['HTTP_HOST'] == 'li3bootstrap.local' || $_SERVER['HTTP_HOST'] == 'localhost') {
Environment::set('development');
}
/**
* Dispatcher rules to rewrite admin actions.
*/
Dispatcher::config(array('rules' => array('admin' => array('action' => 'admin_{:action}'))));
/**
* "/admin" is the prefix for all Lithium Bootstrap admin routes.
* Any "plugin" or library written for use with Lithium Bootstrap can utilize these routes
* without needing to write any additional routes in most cases as this handles the basic CRUD.
* It also handles pagination.
*
* Admin pages can be added to the main app's "/views/_libraries/li3b_core/pages" directory
* and are accessible viw /admin/page/{:args}
*
* NOTE: li3b_core has no controller other than the pages controller. Other libraries and the
* main application are where controllers belong. li3b_core is just the skeleton and assumes
* no functionality. Static pages are as far as it goes.
*/
Router::connect("/admin", array('admin' => true, 'controller' => 'pages', 'action' => 'view', 'args' => array()), array('persist' => array('controller', 'admin')));
Router::connect("/admin/page/{:args}", array('admin' => true, 'controller' => 'pages', 'action' => 'view', 'args' => array()), array('persist' => array('controller', 'admin')));