新路线返回 404
New Route returning 404
我正在尝试在我的站点上安装以下包:https://github.com/comur/ComurImageBundle
我做了安装部分提到的所有事情。我可以看到捆绑包已成功安装,我在管理面板上没有任何错误。但是当捆绑包创建模态时,我收到一个 JS 错误,指出从 /image-library 路由接收到格式错误的 JSON。
如果我在浏览器中浏览这个路由,我得到一个 404 页面,我不明白为什么。我检查了路线,一切正常:
C:\server\www>php app/console router:debug comur_api_image_library
[router] Route "comur_api_image_library"
Name comur_api_image_library
Path /image-library
Host ANY
Scheme ANY
Method ANY
Class Symfony\Component\Routing\Route
Defaults _controller: Comur\ImageBundle\Controller\UploadController::getLibraryImagesAction
Requirements NO CUSTOM
Options compiler_class: Symfony\Component\Routing\RouteCompiler
expose: true
Path-Regex #^/image\-library$#s
路由调试似乎没问题。我成功地使用 php app/console fos:js-routing:dump 将路由公开到 FOSJSRouting 包,我可以在我的 fos_js_routes.js 中找到路由:
"comur_api_image_library":{"tokens":[["text","\/image-library"]],"defaults":[],"requirements":[],"hosttokens":[]}},"prefix":"","host":"localhost","scheme":"http"}
我清除了缓存,重建了bootstrap.php.cache,还是这条路由returns 404。
有什么想法吗?
终于找到问题了
我的主要路由文件如下:
# Route ZF1 Wrapper
zf1_wrapper:
resource: "@Zf1WrapperBundle/Resources/config/routing.yml"
prefix: /
# Routes Bundles Tiers
comur_image:
resource: "@ComurImageBundle/Resources/config/routing.yml"
prefix: /
fos_js_routing:
resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml"
我换成了
# Routes Bundles Tiers
comur_image:
resource: "@ComurImageBundle/Resources/config/routing.yml"
prefix: /
fos_js_routing:
resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml"
# Route ZF1 Wrapper
zf1_wrapper:
resource: "@Zf1WrapperBundle/Resources/config/routing.yml"
prefix: /
一切正常。这个 ZF1Bundle 路由解析器必须是最后定义的路由。我想只有少数人会使用这个包,但也许这个答案会对某人有所帮助。
我正在尝试在我的站点上安装以下包:https://github.com/comur/ComurImageBundle
我做了安装部分提到的所有事情。我可以看到捆绑包已成功安装,我在管理面板上没有任何错误。但是当捆绑包创建模态时,我收到一个 JS 错误,指出从 /image-library 路由接收到格式错误的 JSON。 如果我在浏览器中浏览这个路由,我得到一个 404 页面,我不明白为什么。我检查了路线,一切正常:
C:\server\www>php app/console router:debug comur_api_image_library
[router] Route "comur_api_image_library"
Name comur_api_image_library
Path /image-library
Host ANY
Scheme ANY
Method ANY
Class Symfony\Component\Routing\Route
Defaults _controller: Comur\ImageBundle\Controller\UploadController::getLibraryImagesAction
Requirements NO CUSTOM
Options compiler_class: Symfony\Component\Routing\RouteCompiler
expose: true
Path-Regex #^/image\-library$#s
路由调试似乎没问题。我成功地使用 php app/console fos:js-routing:dump 将路由公开到 FOSJSRouting 包,我可以在我的 fos_js_routes.js 中找到路由:
"comur_api_image_library":{"tokens":[["text","\/image-library"]],"defaults":[],"requirements":[],"hosttokens":[]}},"prefix":"","host":"localhost","scheme":"http"}
我清除了缓存,重建了bootstrap.php.cache,还是这条路由returns 404。 有什么想法吗?
终于找到问题了
我的主要路由文件如下:
# Route ZF1 Wrapper
zf1_wrapper:
resource: "@Zf1WrapperBundle/Resources/config/routing.yml"
prefix: /
# Routes Bundles Tiers
comur_image:
resource: "@ComurImageBundle/Resources/config/routing.yml"
prefix: /
fos_js_routing:
resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml"
我换成了
# Routes Bundles Tiers
comur_image:
resource: "@ComurImageBundle/Resources/config/routing.yml"
prefix: /
fos_js_routing:
resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml"
# Route ZF1 Wrapper
zf1_wrapper:
resource: "@Zf1WrapperBundle/Resources/config/routing.yml"
prefix: /
一切正常。这个 ZF1Bundle 路由解析器必须是最后定义的路由。我想只有少数人会使用这个包,但也许这个答案会对某人有所帮助。