setBasePath(DIRECTORY_SEPARATOR . Config::basepath()); } $router->addMatchTypes(array('cid' => '[a-zA-Z0-9-_+,\'!%@&.$€=\(\|\)]+')); $router->addRoutes([ ['GET|POST', '/', 'Backrouter#run', 'backrouter'], ['GET', '/[cid:art]/', 'Controllerart#read', 'artread/'], ['GET', '/[cid:art]', 'Controllerart#read', 'artread'], ['GET', '/[cid:art]/add', 'Controllerart#add', 'artadd'], ['GET', '/[cid:art]/edit', 'Controllerart#edit', 'artedit'], ['GET', '/[cid:art]/log', 'Controllerart#log', 'artlog'], ['POST', '/[cid:art]/edit', 'Controllerart#update', 'artupdate'], ['GET', '/[cid:art]/delete', 'Controllerart#confirmdelete', 'artconfirmdelete'], ['POST', '/[cid:art]/delete', 'Controllerart#delete', 'artdelete'], ]); $match = $router->match(); if ($match) { $callableParts = explode('#', $match['target']); $controllerName = $callableParts[0]; $methodName = $callableParts[1]; $controller = new $controllerName($router); call_user_func_array(array($controller, $methodName), $match['params']); } //404 else { if(!empty(Config::route404())) { $controller = new Controller($router); $controller->routedirect('artread/', ['art' => Config::route404()]); } else { header($_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found'); } } } }