php-Symfony:找不到“GET http://localhost:8000/assets/My-first-asset-1”的路由(来自“http://localhost:8000/”)
发布时间:2022-04-30 11:37:48 298
相关标签: # 后端
如您所见,这是我的 PropertyController 中的 show 方法:
/**
* @Route("/biens/{slug}-{id<\d+>}", name="property.show", requirements={"slug": "[a-z0-9\-]*"})
* @return Response
*/
public function show($slug, $id): Response
{
$property = $this->repository->find($id);
return $this->render('property/show.html.twig', [
'property' => $property,
'current_menu' => 'properties'
]);
}
在我的 home.html.twig 文件中,这是我的代码的一部分:
<a href="{{ path('property.show', {slug: property.slug, id: property.id}) }}">{{ property.title }}</a>
然而,我真的不明白为什么我在尝试访问链接时会收到这个错误消息,尽管我可以看到我的url。
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报