1、xdebug安装
把phpinfo()打印出来的页面复制到http://www.xdebug.org/find-binary.php,可以自动检测当前PHP版本需要下载哪一个,然后按照它的建议去下载,放到指定的php/ext目录下面,配置好对应的php.ini的扩展位置即可
;指定Xdebug扩展文件的绝对路径
zend_extension="C:\App\php\php\php-7.0.12-nts\ext\php_xdebug-2.7.0alpha1-7.0-vc14-nts.dll"
;启用性能检测分析
xdebug.profiler_enable=On
;启用代码自动跟踪
xdebug.auto_trace=on
;指定堆栈跟踪文件的存放目录
xdebug.trace_output_dir="C:\App\php\debug"
;指定性能分析文件的存放目录
xdebug.profiler_output_dir="C:\App\php\debug"
;指定追踪文件名格式
xdebug.profiler_output_name = "cachegrind.out.%p"
2、webgrind下载
这是一个php站点,https://github.com/jokkedk/webgrind下载zip压缩,解压之后配置好站点,
打开config.php 配置
static $storageDir = 'C:/App/php/debug'; // 配置为xdebug xdebug.profiler_output_dir 所指的目录即可
3、使用webgrind
每当执行一个php脚本,打开webgrind站点,点击右上角update即可