예제 #1
0
파일: App.php 프로젝트: jbrat/uFrameworkPHP
 public function run(Request $request = null)
 {
     if (null === $request) {
         $request = Request::createFromGlobals();
     }
     $method = $request->getMethod();
     $uri = $request->getUri();
     foreach ($this->routes as $route) {
         if ($route->match($method, $uri)) {
             return $this->process($route, $request);
         }
     }
     throw new HttpException(404, 'Page Not Found');
 }
예제 #2
0
 public function run(Request $request = null)
 {
     //Remplacer par $method = $request->getMethode();
     //$method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : self::GET;
     //$uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/';
     if (null === $request) {
         $request = Request::createFromGlobals();
     }
     $uri = $request->getURI();
     $method = $request->getMethod();
     foreach ($this->routes as $route) {
         if ($route->match($method, $uri)) {
             return $this->process($route, $request);
         }
     }
     throw new HttpException(404, 'Page Not Found');
 }