How can I tell PHP to dump exceptions as raw text instead of HTML?

后端 未结 3 570
陌清茗
陌清茗 2020-12-11 03:38

When I\'m developing my REST API in PHP I\'m working with application/json output, so when I get errors while testing in the browser they look like this:

<
3条回答
  •  再見小時候
    2020-12-11 04:03

    In your php.ini you can set three different settings to change how HTML errors are displayed.

    • html_errors
    • error_prepend_string String to output before an error message
    • error_append_string String to output after an error message

    I use the following in my development environment:

    html_errors = On
    error_prepend_string = "
    "
    error_append_string = "
    "

提交回复
热议问题