webman 路由冲突 Static route shadowed by previously defined variable route
代码
use Webman\Route;
Route::any('/goods', [app\controller\Goods::class, 'index']);
Route::any('/goods/{id}', [app\controller\Goods::class, 'show']);
Route::disableDefaultRoute();
报错信息
Fatal error: Uncaught FastRoute\BadRouteException: Static route "/goods/index" is shadowed by previously defined variable route "/goods/([^/]+)" for method "GET" in /mnt/hgfs/fastadmin.test/webman/vendor/nikic/fast-route/src/DataGenerator/RegexBasedAbstract.php:95
Stack trace:
#0 /mnt/hgfs/fastadmin.test/webman/vendor/nikic/fast-route/src/DataGenerator/RegexBasedAbstract.php(30): FastRoute\DataGenerator\RegexBasedAbstract->addStaticRoute()
#1 /mnt/hgfs/fastadmin.test/webman/vendor/nikic/fast-route/src/RouteCollector.php(44): FastRoute\DataGenerator\RegexBasedAbstract->addRoute()
#2 /mnt/hgfs/fastadmin.test/webman/vendor/workerman/webman-framework/src/Route.php(301): FastRoute\RouteCollector->addRoute()
#3 /mnt/hgfs/fastadmin.test/webman/vendor/workerman/webman-framework/src/Route.php(160): Webman\Route::addRoute()
#4 /mnt/hgfs/fastadmin.test/webman/config/plugin/webman/auto-route/route.php(58): Webman\Route::any()
#5 /mnt/hgfs/fastadmin.test/webman/config/plugin/webman/auto-route/route.php(76): Webman\Route::{closure}()
# in /mnt/hgfs/fastadmin.test/webman/vendor/nikic/fast-route/src/DataGenerator/RegexBasedAbstract.php on line 95
1个回答
年代过于久远,无法发表回答
可以了 谢谢
nice