XDebug 提供配置指令 xdebug.profiler_enable_trigger
允许通过传递 GET 或 POST 参数XDEBUG_PROFILE"来激活分析.通过 HTTP 调用脚本时.如果您不想分析所有脚本,而只想分析少数特殊情况而不总是更改 PHP 配置,这会很方便.
XDebug offers the configuration directive xdebug.profiler_enable_trigger
that allows to activate profiling by passing the GET or POST parameter "XDEBUG_PROFILE" when calling a script via HTTP. This is handy if you don't want profiling for ALL of your scripts but only for a few special cases without always changing your PHP configuration.
有没有办法为命令行 PHP 程序实现相同的行为?我试图将 XDEBUG_PROFILE
作为命令行参数传递,但没有奏效.
Is there a way to achieve the same behavior for command line PHP programs? I tried to pass the XDEBUG_PROFILE
as a command line argument but it didn't work.
总的来说,分析命令行 PHP 效果很好,但我希望具有与浏览器和 HTTP 服务器相同的每次调用灵活性.
In general, profiling command line PHP works well, but I'd like to have the same per-call-flexibility as with a browser and HTTP server.
您可以使用 -d
标志传递 INI 设置:php -d xdebug.profiler_enable=On script.php代码>.
You can pass INI settings with the -d
flag: php -d xdebug.profiler_enable=On script.php
.
这篇关于如何为命令行 PHP 脚本触发 XDebug 分析器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!