問題描述
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模板網!