本文整理匯總了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')));