调试配置参考 (DebugBundle)
DebugBundle 集成了 Symfony 应用中的 VarDumper 组件。所有这些选项都在你的应用配置中的 debug
键下配置。
1 2 3 4 5 6 7 8 9
# displays the default config values defined by Symfony
$ php bin/console config:dump-reference framework
# displays the actual config values used by your application
$ php bin/console debug:config framework
# displays the config values used by your application and replaces the
# environment variables with their actual values
$ php bin/console debug:config --resolve-env framework
注意
当使用 XML 时,你必须使用 http://symfony.ac.cn/schema/dic/debug
命名空间,相关的 XSD 架构可以在这里找到:http://symfony.ac.cn/schema/dic/debug/debug-1.0.xsd
配置
min_depth
类型: integer
默认值: 1
配置最小树深度,在该深度之前,所有项目都保证被克隆。达到此深度后,只会克隆 max_items
个项目。默认值是 1
,这与旧版本的 Symfony 一致。
dump_destination
类型: string
默认值: null
配置转储的输出目标。
默认情况下,当返回 HTML 时,转储会显示在 WebDebugToolbar 中。由于这并非总是可能(例如,在处理 JSON API 时),你可以为转储设置一个备用输出目标。通常,你会将其设置为 php://stderr
1 2 3
# config/packages/debug.yaml
debug:
dump_destination: php://stderr
将其配置为 "tcp://%env(VAR_DUMPER_SERVER)%"
以使用 ServerDumper 功能。
这项工作,包括代码示例,根据 Creative Commons BY-SA 3.0 许可获得许可。