您的位置:首页 > 编程语言 > PHP开发

如何使用SublimeText3配置 PHP IDE环境

2021-05-27 04:11 841 查看

首先是安装好PHP之后配置环境变量

然后在cmd中输入php -v 能看到版本号即为配置好了

之后在sublime中新建编译系统,输入代码

{

"cmd": ["php", "$file"],

"file_regex": "^(...*?):([0-9]*):?([0-9]*)",

"selector": "source.php"

}

然后保存在默认位置,改名字为php.sublime-build 然后就好了,输入简单的php语句按Ctrl+B就能看见结果了。

之后进行Xdebug的安装
我们先去查看php.ini的内容新建一个php文件只写一个phpinfo()函数

<?php
phpinfo();
?>

然后用浏览器运行(wampserver要放到www里面用localhost/…去访问)然后可以看到

 然后右键查看源码,然后将所有代码复制到这里https://xdebug.org/wizard.php去分析php所对应的xdebug版本

 最下面会让你下载对应的版本以及需要将其放到哪里,修改什么内容,如果是使用wampserver的可以点左下角的图标,php里面的php.ini打开进行修改,由于wampserver里面本身会有一些xdebug的配置,我们可以注释掉,最终的配置如下:

[xdebug]
zend_extension = E:\wamp64\bin\php\php5.6.19\ext\php_xdebug-2.4.0-5.6-vc11-x86_64.dll
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
;xdebug.remote_enable = off
;xdebug.profiler_enable = off
;xdebug.profiler_enable_trigger = off
;xdebug.profiler_output_name = cachegrind.out.%t.%p
;xdebug.profiler_output_dir ="E:/wamp64/tmp"
;xdebug.show_local_vars=0

之后重启所有服务器之后,在sublime中用package conctrol下载xdebug client 然后就可以调试了

  • Shift+f8: 打开调试面板
  • f8:打开调试面板快速连接
  • Ctrl+f8: 切换断点
  • Ctrl+Shift+f5: 运行到下一个断点
  • Ctrl+Shift+f6: 单步
  • Ctrl+Shift+f7: 步入
  • Ctrl+Shift+f8: 步出

chrome 上可以安一个xdebug helper这样就能在网页上进行调试了

您可能感兴趣的文章:
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  php sublimetext xdebug