首页 » SEO优化 » vim搞php适合技巧_Vim运用XDebug支持Php调试

vim搞php适合技巧_Vim运用XDebug支持Php调试

访客 2024-12-07 0

扫一扫用手机浏览

文章目录 [+]

一、事理

Php调试的办法有很多,最常用的便是通过打印来办理,打印带来的毛病也比较明显,便是不足直不雅观,而且繁琐,打的不准的话,会摧残浪费蹂躏很多韶光,以是这里给大家先容一种常用调试办法,利用xdebug来实现,这次我们将和Vim结合,详细事理如下:

vim搞php适合技巧_Vim运用XDebug支持Php调试

二、xdebug安装配置

vim搞php适合技巧_Vim运用XDebug支持Php调试
(图片来自网络侵删)

1、为php安装xdebug.so扩展

wget https://xdebug.org/files/xdebug-2.5.4.tgz tar xf xdebug-2.5.4.tgz cd xdebug-2.5.4 phpize ./configure --enable-xdebug make cp modules/xdebug.so /usr/lib64/php/modules/

2、配置php

cd /etc/php.d

新建xdebug.ini,填入如下内容:

zend_extension =/usr/lib64/php/modules/xdebug.so xdebug.remote_enable=on xdebug.remote_handler=dbgp xdebug.remote_host=127.0.0.1 xdebug.remote_port=9010

3、重启php-fpm

sudo service php-fpm restart

三、Vim插件安装配置

往.vimrc中插入

Bundle 'joonty/vdebug' \"大众=================================== \公众xdebug \公众================================== let g:vdebug_options = {} let g:vdebug_options[\"大众port\"大众] = 9010

在命令模式下,实行BundleInstall

四、详细操作

1、打开你要调试的php文件

2、光标移动到你要调试的行,按下<F10>添加一个行断点

3、按下<F5>,开始调试状态,在vim底下会涌现类似下面的信息

4、打开浏览器,输入你的Url,并在末端添加 ?XDEBUG_SESSION_START=1,例如,http:://localhost/index.php → http://localhost/index.php?XDEBUG_SESSION_START=1

然后刷新页面,在vim中就会看到如下信息:

五、调试指南

<F5>: start/run (to next breakpoint/end of script)

<F2>: step over <F3>: step into <F4>: step out <F6>: stop debugging (kills script) <F7>: detach script from debugger <F9>: run to cursor <F10>: toggle line breakpoint <F11>: show context variables (e.g. after \"大众eval\"大众) <F12>: evaluate variable under cursor :Breakpoint <type> <args>: set a breakpoint of any type (see :help VdebugBreakpoints) :VdebugEval <code>: evaluate some code and display the result <Leader>e: evaluate the expression under visual highlight and display the result

标签:

相关文章

我国土地利用分类代码的构建与应用

土地利用分类代码是我国土地管理的重要组成部分,是土地资源调查、规划、利用和保护的依据。土地利用分类代码的构建与应用显得尤为重要。本...

SEO优化 2025-02-18 阅读1 评论0

微信跳转微信支付便捷支付体验的秘密武器

移动支付已成为人们日常生活中不可或缺的一部分。作为我国领先的社交平台,微信支付凭借其便捷、安全的支付方式,深受广大用户的喜爱。而微...

SEO优化 2025-02-18 阅读1 评论0

探寻会计科目代码背后的奥秘分类与

会计科目代码是会计信息系统中不可或缺的组成部分,它将企业的经济活动进行分类和归纳,为会计核算、财务分析和决策提供重要依据。本文将从...

SEO优化 2025-02-18 阅读1 评论0