Symfony 未找到页面
Symfony not found page
如何在symfony 4.1 中设置通用的nof found 页面?下一个代码
/**
* @Route("/{notfoundurl}", name="path_notfound")
*/
public function notFound() {
return $this->render('templates/bundles/TwigBundle/Exception/error404.html.twig', []);
}
拒绝使用其他网址,例如 /login
http://localhost:8000/login
谢谢
您只需覆盖错误页面的树枝模板即可。请参阅文档:
https://symfony.com/doc/current/controller/error_pages.html
如果您处于开发模式,则必须查看此文档:
https://symfony.com/doc/current/controller/error_pages.html#testing-error-pages-during-development
如何在symfony 4.1 中设置通用的nof found 页面?下一个代码
/**
* @Route("/{notfoundurl}", name="path_notfound")
*/
public function notFound() {
return $this->render('templates/bundles/TwigBundle/Exception/error404.html.twig', []);
}
拒绝使用其他网址,例如 /login
http://localhost:8000/login
谢谢
您只需覆盖错误页面的树枝模板即可。请参阅文档:
https://symfony.com/doc/current/controller/error_pages.html
如果您处于开发模式,则必须查看此文档:
https://symfony.com/doc/current/controller/error_pages.html#testing-error-pages-during-development