如何运行时禁用 xDebug 的 var_dump 和错误美化? [英] How to runtime disable xDebug's var_dump and errors prettify?

查看:32
本文介绍了如何运行时禁用 xDebug 的 var_dump 和错误美化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有时更喜欢使用

header("Content-type: text/plain");

不要乱用 HTML.但是,无论何时发生错误,或者当我使用 var_dump() 时,它都会发出一个大的 HTML 块来美化输出.虽然它在 HTML 上下文中很棒,但当我在 text/plain 中工作时,我想禁用它.

Do not mess around with HTML. However, whenever an error occurs, or when I use var_dump(), it would issue a large HTML block to prettify the output. While it's great in HTML context, I would like to disable it when I work in text/plain.

可以吗?运行时禁用美化?

Is it possible to do? Runtime disable of the prettify?

推荐答案

如果启用了 PHP HTML 错误,XDebug 将向您显示错误.您可以执行以下操作之一

XDebug will show you an error if PHP HTML errors are enabled. You can do one of the following

  1. 您可以禁止显示 php 错误.

  1. You can disable php errors from displayed.

ini_set('display_errors', 0)

或者您可以将 xdebug 的 php.ini 的 html_errors = On 设置更改为 html_errors = Off'

Or you can change html_errors = On setting of php.ini for xdebug to html_errors = Off'

ini_set('html_errors', 'off')

但您应该知道,使用 ini_set() 无法防止出现 PARSE 错误.

But you should know, you cannot prevent PARSE errors from appearing using ini_set().

这篇关于如何运行时禁用 xDebug 的 var_dump 和错误美化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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