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


PHP Zend_Controller_Router_Rewrite::route方法代码示例

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


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

示例1: header

 function _initHeader()
 {
     //date_default_timezone_set("PRC");
     header("Content-Type:text/html;charset=utf-8");
     $config = new Zend_Config_Ini(CONFIGS_PATH . '/application.ini', 'production');
     defined("SYS_NAME") || define("SYS_NAME", $config->sys->name);
     defined("SYS_COPYRIGHT") || define("SYS_COPYRIGHT", $config->sys->copyright . date('Y'));
     defined("SYS_EMAIL_SUFFIX") || define("SYS_EMAIL_SUFFIX", $config->sys->email_suffix);
     $page_head = '<title>' . SYS_NAME . '</title>
                   <link type="image/x-icon" rel=icon href="' . HOME_PATH . '/public/images/favicon.ico">
                   <link rel="stylesheet" type="text/css" href="' . HOME_PATH . '/public/css/style.css"/>
                   <link rel="stylesheet" type="text/css" href="' . HOME_PATH . '/public/css/icon.css"/>
                   <link rel="stylesheet" type="text/css" href="' . HOME_PATH . '/library/ext/resources/css/ext-all.css">
                   <link rel="stylesheet" type="text/css" href="' . HOME_PATH . '/public/css/BoxSelect.css">
                   <script type="text/javascript" src="' . HOME_PATH . '/library/ext/ext-all.js"></script>
                   <script type="text/javascript" src="' . HOME_PATH . '/library/ext/locale/ext-lang-zh_CN.js"></script>
                   <script type="text/javascript" src="' . HOME_PATH . '/public/js/BoxSelect.js"></script>
                   <script type="text/javascript" src="' . HOME_PATH . '/public/js/EmployeeCombo.js"></script>
                   <script type="text/javascript">Ext.override(Ext.view.Table, { enableTextSelection: true });var homePath="' . HOME_PATH . '";</script>';
     defined("SYS_HEAD") || define("SYS_HEAD", $page_head);
     $router = new Zend_Controller_Router_Rewrite();
     $request = new Zend_Controller_Request_Http();
     $router->route($request);
     $controller = $request->getControllerName();
     $action = $request->getActionName();
     // 已登录验证过滤
     if ($controller != 'home' && $controller != 'index' && $controller != 'login' && $controller != 'hra' && $controller != 'admin' && $controller != 'dcc' || $controller == 'hra' && $action != 'news' || $controller == 'admin' && $action != 'cron' || $controller == 'dcc' && $action != 'upload') {
         $user_session = new Zend_Session_Namespace('user');
         if (!isset($user_session->user_info)) {
             exit("<script>window.location.href='" . HOME_PATH . "/public/home/login';</script>");
         }
     }
 }
开发者ID:xindalu,项目名称:evolve,代码行数:33,代码来源:Bootstrap.php

示例2: _route

 /**
  * Same route function in Zend_Controller_Front::dispatch().
  * It updates the request with routes and sends a message to
  * Zend_Controller_Front. This is processed in dispatch().
  * 
  * @param Zend_Controller_Request_Abstract $request
  */
 private function _route(Zend_Controller_Request_Abstract $request)
 {
     try {
         $this->_router->route($request);
     } catch (Exception $e) {
         if ($this->_front->throwExceptions()) {
             throw $e;
         }
     }
 }
开发者ID:riteshsahu1981,项目名称:Weadvance,代码行数:17,代码来源:App.php

示例3: testInstall

 /**
  * Test own route
  */
 public function testInstall()
 {
     // set request and start routing
     $this->_request->setRequestUri('install.php');
     $request = $this->_router->route($this->_request);
     // check result
     $this->assertEquals('install', $this->_router->getCurrentRouteName());
     $this->assertEquals('default', $request->getModuleName());
     $this->assertEquals('index', $request->getControllerName());
     $this->assertEquals('index', $request->getActionName());
 }
开发者ID:google-code-backups,项目名称:rsslounge,代码行数:14,代码来源:RoutingTest.php

示例4: route

 public function route(Zend_Controller_Request_Abstract $request)
 {
     // Let the Rewrite router route the request first
     $request = parent::route($request);
     if ($request->getParam('page') == '') {
         // If the page param isn't set, route to default page and controller
         $defaultPage = Brightfame_Page_Manager::getInstance()->getDefaultPage();
         //$request->setControllerName($defaultPage->pageType->controller);
         //$request->setParam('page',$defaultPage->page);
     } else {
         // Route to current page's controller
         $page = Brightfame_Page_Manager::getInstance()->getPage($request->getParam('page'));
         //$request->setControllerName($page->pageType->controller);
     }
     return $request;
 }
开发者ID:robsta,项目名称:brightfamecms,代码行数:16,代码来源:Page.php

示例5: route

 /**
  * Find a matching route to the current PATH_INFO and inject
  * returning values to the Request object.
  *
  * @throws Zend_Controller_Router_Exception
  * @return Zend_Controller_Request_Abstract Request object
  */
 public function route(Zend_Controller_Request_Abstract $request)
 {
     if (($curRouteName = $this->_currentRoute) != null) {
         $route = $this->getRoute($curRouteName);
         if (!method_exists($route, 'getVersion') || $route->getVersion() == 1) {
             $match = $request->getPathInfo();
         } else {
             $match = $request;
         }
         if ($params = $route->match($match)) {
             $this->_setRequestParams($request, $params);
             return $request;
         }
     }
     return parent::route($request);
 }
开发者ID:nstapelbroek,项目名称:Glitch_Lib,代码行数:23,代码来源:Rewrite.php

示例6: route

 public function route(Zend_Controller_Request_Abstract $request)
 {
     // Let the Rewrite router route the request first
     $request = parent::route($request);
     logFire("ROUTE", $request->getParam('controller'));
     if ($request->getParam('controller') == '') {
         // If the page param isn't set, route to default page and controller
         $defaultPage = PageManager::getInstance()->getDefaultPage();
         $request->setControllerName($defaultPage->pageType->controller);
         $request->setParam('controller', $defaultPage->page);
         $request->setParam('action', 'index');
     } else {
         // Route to current page's controller
         $controller = PageManager::getInstance()->getPage($request->getParam('controller'));
         $request->setControllerName($controller->pageType->controller);
         $request->setActionName('index');
     }
     $request->setParam('controller', 'search');
     $request->setParam('action', 'search');
     return $request;
 }
开发者ID:xinghao,项目名称:shs,代码行数:21,代码来源:Router.php

示例7: testConfigChaining

 public function testConfigChaining()
 {
     $routes = array('www' => array('type' => 'Zend_Controller_Router_Route_Hostname', 'route' => 'www.example.com', 'abstract' => true), 'user' => array('type' => 'Zend_Controller_Router_Route_Hostname', 'route' => 'user.example.com', 'abstract' => true), 'index' => array('type' => 'Zend_Controller_Router_Route_Static', 'route' => '', 'abstract' => true, 'defaults' => array('module' => 'default', 'controller' => 'index', 'action' => 'index')), 'imprint' => array('type' => 'Zend_Controller_Router_Route_Static', 'route' => 'imprint', 'abstract' => true, 'defaults' => array('module' => 'default', 'controller' => 'index', 'action' => 'imprint')), 'profile' => array('type' => 'Zend_Controller_Router_Route_Static', 'route' => 'profile', 'abstract' => true, 'defaults' => array('module' => 'user', 'controller' => 'profile', 'action' => 'index')), 'profile-edit' => array('type' => 'Zend_Controller_Router_Route_Static', 'route' => 'profile/edit', 'abstract' => true, 'defaults' => array('module' => 'user', 'controller' => 'profile', 'action' => 'edit')), 'www-index' => array('type' => 'Zend_Controller_Router_Route_Chain', 'chain' => 'www, index'), 'www-imprint' => array('type' => 'Zend_Controller_Router_Route_Chain', 'chain' => 'www, imprint'), 'user-index' => array('type' => 'Zend_Controller_Router_Route_Chain', 'chain' => 'user, index'), 'user-profile' => array('type' => 'Zend_Controller_Router_Route_Chain', 'chain' => 'user, profile'), 'user-profile-edit' => array('type' => 'Zend_Controller_Router_Route_Chain', 'chain' => 'user, profile-edit'));
     $router = new Zend_Controller_Router_Rewrite();
     $front = Zend_Controller_Front::getInstance();
     $front->resetInstance();
     $front->setDispatcher(new Zend_Controller_Router_ChainTest_Dispatcher());
     $front->setRequest(new Zend_Controller_Router_ChainTest_Request());
     $router->setFrontController($front);
     $router->addConfig(new Zend_Config($routes));
     $request = new Zend_Controller_Router_ChainTest_Request('http://user.example.com/profile');
     $token = $router->route($request);
     $this->assertEquals('user', $token->getModuleName());
     $this->assertEquals('profile', $token->getControllerName());
     $this->assertEquals('index', $token->getActionName());
     $request = new Zend_Controller_Router_ChainTest_Request('http://foo.example.com/imprint');
     $token = $router->route($request);
     $this->assertEquals('default', $token->getModuleName());
     $this->assertEquals('imprint', $token->getControllerName());
     $this->assertEquals('defact', $token->getActionName());
 }
开发者ID:JeancarloPerez,项目名称:booking-system,代码行数:21,代码来源:ChainTest.php

示例8: route

 /**
  * Find a matching route to the current PATH_INFO and inject
  * returning values to the Request object.
  *
  * @throws Zend_Controller_Router_Exception
  * @return Zend_Controller_Request_Abstract Request object
  */
 public function route(Zend_Controller_Request_Abstract $request)
 {
     //sort routes
     $this->sortRoutes();
     return parent::route($request);
 }
开发者ID:baisoo,项目名称:axiscommerce,代码行数:13,代码来源:Rewrite.php

示例9: testMultipleChainsResettingPathInfoInSegmentBlock

 /**
  * @throws Zend_Controller_Router_Exception
  */
 public function testMultipleChainsResettingPathInfoInSegmentBlock()
 {
     $foo = new Zend_Controller_Router_Route_SubclassTest('notfoo');
     $bar = new Zend_Controller_Router_Route_SubclassTest('bar', array('baz' => 'no'));
     $chain = $foo->chain($bar);
     $static = new Zend_Controller_Router_Route_SimpleSubclassTest('/foo', array('foo' => 'foo'));
     $rewrite = new Zend_Controller_Router_Rewrite();
     $rewrite->addRoute('static', $static);
     // First In Last Out, we want this to be matched against second
     $rewrite->addRoute('chain', $chain);
     $request = new Zend_Controller_Router_ChainTest_Request('http://www.zend.com/foo');
     $res = $rewrite->route($request);
     $this->assertEquals('foo', $res->getParam('foo'), 'Route did not match');
     $this->assertEquals('static', $rewrite->getCurrentRouteName(), 'Routing did not match expected route');
 }
开发者ID:crodriguezn,项目名称:crossfit-milagro,代码行数:18,代码来源:ChainTest.php


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