The custom route doesn't work correctly and always routes to user.htm
index.php
$routes = [
"/" => "index.htm",
"/user/id=@id" => "user.htm","/user/@id" => "user.htm",
];
foreach ($routes as $path => $file) {
$f3->route("GET ".$path,
function($f3){
global $file,$path;
echo View::instance()->render($file);
}
);
}
try this:
$routes = [
"/" => "index.htm",
"/user/id=@id" => "user.htm",
"/user/@id" => "user.htm",
];
foreach ($routes as $path => $file)
{
$f3->route("GET " . $path,
function ($f3) use ($file)
{
echo View::instance()->render($file);
}
);
}