How to Simulate 500 Error in Symfony 2

前端 未结 6 863
闹比i
闹比i 2021-02-07 00:25

I am wondering how would I simulate a 500 error in Symfony 2.

I have been reading this post where Raise suggests throwing an exception

6条回答
  •  忘掉有多难
    2021-02-07 01:24

    The simplest way to do this is to:

    return new Response('', 500);

    Don't forget to include Symfony\Component\HttpFoundation\Response.

提交回复
热议问题