當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Dispatcher::config方法代碼示例

本文整理匯總了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')));
 }
開發者ID:nashadalam,項目名稱:lithium,代碼行數:6,代碼來源:DispatcherTest.php

示例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')));
開發者ID:tmaiaroto,項目名稱:li3b_core,代碼行數:31,代碼來源:routes.php


注:本文中的lithium\action\Dispatcher::config方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。