// 根據(jù)文件路徑計算uri
$uri_path = str_replace(['/controller/', '/Controller/'], '/', substr(substr($file_path, strlen(app_path())), 0, - (4 + $suffix_length)));
需要把$uri_path轉(zhuǎn)化為小寫
// 根據(jù)文件路徑計算uri
$uri_path = str_replace(['/controller/', '/Controller/'], '/', substr(substr($file_path, strlen(app_path())), 0, - (4 + $suffix_length)));
$uri_path = strtolower($uri_path);
要不然下面這句根本執(zhí)行不到:
if (substr($uri_path, -6) === '/index') {
$route(substr($uri_path, 0, -6), [$class_name, $action]);
}
還有一個問題是,不知道算不算問題,就是沒有注冊/路由