如果包含点,则找不到带有路径参数的 Symfony4 路由 [英] Symfony4 Route not found with path param if contains a dot

查看:34
本文介绍了如果包含点,则找不到带有路径参数的 Symfony4 路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我用这个 slug (/client/example.com) 导航到这条路线

If I navigate to this route with this slug (/client/example.com)

/**
 * @Route("/client/{url}")
*/

我收到此错误

在此找不到请求的资源/client/example.com"服务器.

The requested resource "/client/example.com" was not found on this server.

我正在使用 php 内置服务器 php -S 127.0.0.1:8000 public/index.php

I'm using php built-in server php -S 127.0.0.1:8000 public/index.php

使用这种方法可以工作,但资产无法正确加载php -S localhost:8000 public/index.php

With this aproach it works but assets doesn't load properly php -S localhost:8000 public/index.php

没有点就可以了.

php bin/console router:match /client/example.com
[OK] Route "client_show" matches

php bin/console router:match /client/example
[OK] Route "client_show" matches

推荐答案

正如 Lawrence Cherone 在评论中所说的,它似乎不适用于内置的 php 服务器,但它适用于 composer require server 包含在 Symfony 食谱中.

As Lawrence Cherone stated in the comments looks like it doesn't work with the built-in php server but it does work with the composer require server included in Symfony Recipes.

php bin/console server:run

这篇关于如果包含点,则找不到带有路径参数的 Symfony4 路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆