コード例 #1
0
 function __construct($ymlFile)
 {
     $yaml = new Parser();
     $this->ymlFile = file_get_contents($ymlFile);
     $tabRoute = $yaml->parse($this->ymlFile);
     $this->ymlFile = $tabRoute;
     $request = $_SERVER['SCRIPT_NAME'];
     $uri = $_SERVER['REQUEST_URI'];
     Logs::accessLogs($uri);
     $req = str_replace("index.php", "", $request);
     $uri = str_replace($req, "", $uri);
     foreach ($tabRoute as $k) {
         if ($uri == $k['path']) {
             $this->nameRoute = $k['path'];
             $this->controllerRoute = $k['controller'];
             $this->viewController = $k['view'];
             break;
         } else {
             $error = "route introuvable";
             Logs::errorLog($error);
         }
     }
 }