Symfony 404未找到“的路线”;GET/admin/users/";

Symfony 404未找到“的路线”;GET/admin/users/";,symfony,symfony4,symfony-routing,Symfony,Symfony4,Symfony Routing,config/routes.yaml admin_users: resource: '@ProjectUserBundle/Resources/config/routing.yml' prefix: /admin app_locations: resource: '../src/Project/LocationBundle/Controller/' type: annotation Project/UserBundle/Resources/config

config/routes.yaml

admin_users:
    resource: '@ProjectUserBundle/Resources/config/routing.yml'
    prefix: /admin

app_locations:
    resource: '../src/Project/LocationBundle/Controller/'
    type:     annotation
Project/UserBundle/Resources/config/routing.yaml

admin_userslist:
    path: /users
    controller: ProjectUserBundle:Users:index

admin_useradd:
    path: /user/add
    defaults:
    controller: ProjectUserBundle:Users:add

admin_useredit:
    path: /user/edit/{id}
    defaults:
    controller: ProjectUserBundle:Users:edit

admin_usershow:
    path: /user/show/{id}
    defaults:
    controller: ProjectUserBundle:Users:show
php bin/控制台调试:路由器->输出

  homepage                   ANY      ANY      ANY    /
  _twig_error_test           ANY      ANY      ANY    /_error/{code}.{_format}
  _wdt                       ANY      ANY      ANY    /_wdt/{token}
  _profiler_home             ANY      ANY      ANY    /_profiler/
  _profiler_search           ANY      ANY      ANY    /_profiler/search
  _profiler_search_bar       ANY      ANY      ANY    /_profiler/search_bar
  _profiler_phpinfo          ANY      ANY      ANY    /_profiler/phpinfo
  _profiler_search_results   ANY      ANY      ANY    /_profiler/{token}/search/results
  _profiler_open_file        ANY      ANY      ANY    /_profiler/open
  _profiler                  ANY      ANY      ANY    /_profiler/{token}
  _profiler_router           ANY      ANY      ANY    /_profiler/{token}/router
  _profiler_exception        ANY      ANY      ANY    /_profiler/{token}/exception
  _profiler_exception_css    ANY      ANY      ANY    /_profiler/{token}/exception.css
  admin_userslist            ANY      ANY      ANY    /admin/users
  admin_useradd              ANY      ANY      ANY    /admin/user/add
  admin_useredit             ANY      ANY      ANY    /admin/user/edit/{id}
  admin_usershow             ANY      ANY      ANY    /admin/user/show/{id}
  admin_locations_index      ANY      ANY      ANY    /admin/locations/
  admin_location_add         ANY      ANY      ANY    /admin/locations/add
+--------------+----------------------------------------------------------------+
| Property     | Value                                                          |
+--------------+----------------------------------------------------------------+
| Route Name   | admin_userslist                                                |
| Path         | /admin/users                                                   |
| Path Regex   | #^/admin/users$#sD                                             |
| Host         | ANY                                                            |
| Host Regex   |                                                                |
| Scheme       | ANY                                                            |
| Method       | ANY                                                            |
| Requirements | NO CUSTOM                                                      |
| Class        | Symfony\Component\Routing\Route                                |
| Defaults     | _controller: ProjectUserBundle:Users:index                     |
| Options      | compiler_class: Symfony\Component\Routing\RouteCompiler        |
| Callable     | App\Project\UserBundle\Controller\UsersController::indexAction |
+--------------+----------------------------------------------------------------+
php bin/控制台调试:路由器管理\u用户列表->输出

  homepage                   ANY      ANY      ANY    /
  _twig_error_test           ANY      ANY      ANY    /_error/{code}.{_format}
  _wdt                       ANY      ANY      ANY    /_wdt/{token}
  _profiler_home             ANY      ANY      ANY    /_profiler/
  _profiler_search           ANY      ANY      ANY    /_profiler/search
  _profiler_search_bar       ANY      ANY      ANY    /_profiler/search_bar
  _profiler_phpinfo          ANY      ANY      ANY    /_profiler/phpinfo
  _profiler_search_results   ANY      ANY      ANY    /_profiler/{token}/search/results
  _profiler_open_file        ANY      ANY      ANY    /_profiler/open
  _profiler                  ANY      ANY      ANY    /_profiler/{token}
  _profiler_router           ANY      ANY      ANY    /_profiler/{token}/router
  _profiler_exception        ANY      ANY      ANY    /_profiler/{token}/exception
  _profiler_exception_css    ANY      ANY      ANY    /_profiler/{token}/exception.css
  admin_userslist            ANY      ANY      ANY    /admin/users
  admin_useradd              ANY      ANY      ANY    /admin/user/add
  admin_useredit             ANY      ANY      ANY    /admin/user/edit/{id}
  admin_usershow             ANY      ANY      ANY    /admin/user/show/{id}
  admin_locations_index      ANY      ANY      ANY    /admin/locations/
  admin_location_add         ANY      ANY      ANY    /admin/locations/add
+--------------+----------------------------------------------------------------+
| Property     | Value                                                          |
+--------------+----------------------------------------------------------------+
| Route Name   | admin_userslist                                                |
| Path         | /admin/users                                                   |
| Path Regex   | #^/admin/users$#sD                                             |
| Host         | ANY                                                            |
| Host Regex   |                                                                |
| Scheme       | ANY                                                            |
| Method       | ANY                                                            |
| Requirements | NO CUSTOM                                                      |
| Class        | Symfony\Component\Routing\Route                                |
| Defaults     | _controller: ProjectUserBundle:Users:index                     |
| Options      | compiler_class: Symfony\Component\Routing\RouteCompiler        |
| Callable     | App\Project\UserBundle\Controller\UsersController::indexAction |
+--------------+----------------------------------------------------------------+
如果我点击example.com/admin/users/ 我得到这个错误->看标题, 一个知道什么是正确的人


谢谢大家!

在config/routes.yaml中编写:

resource: '@ProjectUserBundle/Resources/config/routing.yml'

扩展名为.yml。但您的文件是routing.yaml、.yaml扩展名。是吗?

您使用什么作为web服务器?您似乎有一个相当奇怪的混合Symfony flex和老式布线。考虑评论位置部分只是为了咧嘴笑。其他路径(如/admin/user/add)是否有效?我的web服务器atm是mamp。。没有一条路由使用前缀/admin/。您是否使用security.yml来限制某些URL?如果是这样的话,当你不是管理员并尝试访问管理员路径时,你会得到一个404错误。我不使用安全atm。admin/users是一个公共路径,请仔细检查服务器是否实际指向正确的项目。我知道这似乎不太可能,但您可能正在编辑一个项目,同时测试另一个项目。还可以考虑使用bin/控制台服务器:开始进行初始测试。问题中的键入。将出现一条完全不同的错误消息,加上这些路由不会出现在调试中:routerTypo my bad,太晚了:)