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


PHP ActionController::process_route方法代码示例

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


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

示例1: dispatch

 /**
 *  Dispatch a request from Apache
 *
 *  Called from file dispatch.php, which is invoked by
 *  {@link http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html Apache mod_rewrite}
 *  whenever a client makes a request.  Actions:
 *  <ol>
 *    <li>Remove forbidden tags and attributes from
 *      {@link http://www.php.net/reserved.variables#reserved.variables.get $_GET},
 *      {@link http://www.php.net/reserved.variables#reserved.variables.post $_POST} and
 *      {@link http://www.php.net/reserved.variables#reserved.variables.request $_REQUEST}.
 </li>
 *    <li>Start a session to keep track of state between requests from
 *      the client.</li>
 *    <li>Construct an ActionController to process the action.</li>
 *    <li>Process the route</li>
 *  </ol>
 *  @uses ActionController::__construct()
 *  @uses ActionController::process_route()
 *  @uses ActionController::process_with_exception()
 *  @uses InputFilter::process_all()
 *  @uses Session::start()
 */
 function dispatch()
 {
     if (TRAX_ENV != 'production') {
         $start = microtime(true);
     }
     try {
         InputFilter::process_all();
         Session::start();
         $ac = new ActionController();
         $ac->process_route();
     } catch (Exception $e) {
         ActionController::process_with_exception($e);
     }
     if (TRAX_ENV != 'production') {
         $duration = "(" . round((microtime(true) - $start) * 1000, 1) . "ms)";
         $url = parse_url($_SERVER['REQUEST_URI']);
         Trax::log("[1mRendered {$url['path']} {$duration}[0m");
     }
 }
开发者ID:phpontrax,项目名称:trax,代码行数:42,代码来源:dispatcher.php

示例2: testProcess_route_missing_class

 /**
  *  Test process_route() with missing controller class
  */
 public function testProcess_route_missing_class()
 {
     //  read routes from config/routes.php
     $ac = new ActionController();
     //  this URL matches default route, but the controller
     //  file doesn't have a Noclass class
     $_SERVER['REDIRECT_URL'] = '/~haas/noclass/foo/bar';
     try {
         $ac->process_route();
     } catch (Exception $e) {
         return;
         $this->assertTrue(is_a($e, 'ActionControllerError'));
         $this->assertEquals('Error Message: Failed to instantiate' . ' controller object "noclass"', $e->getMessage());
         $this->assertEquals('Error Message: Failed to instantiate' . ' controller object "noclass"', $e->error_message);
         $this->assertEquals('ActionController error', $e->error_heading);
         $this->assertEquals('500', $e->error_code);
         return;
     }
     $this->fail('process_route() missing class exception not raised');
 }
开发者ID:phpontrax,项目名称:trax,代码行数:23,代码来源:ActionControllerTest.php


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