addRoutes([ ['GET|POST', '/', 'Backrouter#run', 'backrouter'], ['GET', '/[a:art]/', 'Controllerart#read', 'artread/'], ['GET', '/[a:art]', 'Controllerart#read', 'artread'], ['GET', '/[a:art]/edit', 'Controllerart#edit', 'artedit'], ['GET', '/[a:art]/edit/', 'Controllerart#edit', 'artedit/'], ]); $match = $router->match(); if ($match) { $callableParts = explode('#', $match['target']); $controllerName = $callableParts[0]; $methodName = $callableParts[1]; $controller = new $controllerName(); call_user_func_array(array($controller, $methodName), $match['params']); } //404 else { header($_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found'); } } }