【发布时间】:2020-08-25 18:10:59
【问题描述】:
所以,我在 Heroku 上部署了 Slim 应用程序。只有索引路由(/)有效,其他我得到 404 not found 错误。
这是我的 routes.php 文件
// index
$app->group('', function(RouteCollectorProxy $group) {
$group->get('/', EntryPointController::class . ':index' );
$group->get('/test', EntryPointController::class . ':test' );
});
// api
$app->group('/api/v1', function(RouteCollectorProxy $group) {
$group->get('/products', ProductsController::class . ':all' );
});
Procfile 内容:
web: vendor/bin/heroku-php-apache2 public/
对于所有路由,除了索引路由 (/),我得到 404 错误,尽管在本地主机上一切正常。
那么,请说,如何解决这个问题?
【问题讨论】: