如何使用Visual Studio Code调试PHP CLI应用和Web应用
在按照Jerry的公众号文章 什么?在SAP中国研究院里还需要会PHP开发? 进行XDebug在本地的配置之后,如果想使用Visual Studio Code而不是Eclipse来调试PHP应用,步骤也比较简单。
启动WAMP服务器,确保xdebug.remote_autostart, xdebug.remote_enable都为on:
然后安装Visual Studio Code的扩展:PHP Debug
安装完毕后,File->Preferences->Settings:
添加一条entry:php.validate.executablePath, 指向你本地的php.exe
创建一个PHP debug configuration,有两种方式选择:
Launch current open script和Listen for Xdebug:
{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "Listen for XDebug", "type": "php", "request": "launch", "port": 9000 }, { "name": "Launch currently open script", "type": "php", "request": "launch", "program": "${file}", "cwd": "${fileDirname}", "port": 9000, "runtimeExecutable":"C:\\MyApp\\wamp20190709\\bin\\php\\php7.0.10\\php.exe" } ] }
前者调试PHP CLI应用比较方便,打开一个php文件,直接F5,断点即触发。
如果选择成Listen for XDebug,同样先F5启动调试进程,
然后浏览器里访问待调试的PHP文件,Visual Studio Code的断点即触发,可以单步调试了:
本文来自云栖社区合作伙伴“汪子熙”,了解相关信息可以关注微信公众号"汪子熙"。
低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
- 上一篇
learning_python_list
数据结构 python 中的数据结构 不可变类型 int:整型 float:浮点型 bool:布尔型 str:字符串 可变类型 list:列表 tuple:元组 set:集合 dict:字典 获取数据类型:type() 如: In [1]: type(1) Out[1]: int In [2]: type(1.1) Out[2]: float In [3]: type(True) Out[3]: bool In [3]: type(False) Out[3]: bool 列表 列表(list)([])是一种存储大量数据的存储模型,可以对数据进行增、删、改、查操作。 增加数据 append(self, object): Append object to the end of the list. insert(self, index, object): Insert object before index. extend(self, iterable): Extend list by appending elements from the iterable. 翻译: append(self...
- 下一篇
Thinkphp5.0 PHPExcel 数据表格导出导入
1、先在github里面下载PHPexcel这个类库 或者通过以下链接下载PHPexcel类库。 http://www.php.cn/xiazai/leiku/1491 2、解压之后把它复制到extend里面 控制器代码如下: /** * Created by PhpStorm. * User: luxiao * Date: 2017/5/8 * Time: 16:49 */ namespace app\index\controller; use think\Loader; use think\Controller; class Excel extends Controller { function excel() { $path = dirname(__FILE__); //找到当前脚本所在路径 Loader::import('PHPExcel.Classes.PHPExcel'); //手动引入PHPExcel.php Loader::import('PHPExcel.Classes.PHPExcel.IOFactory.PHPExcel_IOFactory'); //引入IO...
相关文章
文章评论
共有0条评论来说两句吧...
文章二维码
点击排行
推荐阅读
最新文章
- SpringBoot2整合MyBatis,连接MySql数据库做增删改查操作
- CentOS8编译安装MySQL8.0.19
- CentOS6,7,8上安装Nginx,支持https2.0的开启
- SpringBoot2整合Redis,开启缓存,提高访问速度
- CentOS7编译安装Cmake3.16.3,解决mysql等软件编译问题
- CentOS7编译安装Gcc9.2.0,解决mysql等软件编译问题
- Docker快速安装Oracle11G,搭建oracle11g学习环境
- MySQL8.0.19开启GTID主从同步CentOS8
- SpringBoot2全家桶,快速入门学习开发网站教程
- CentOS8,CentOS7,CentOS6编译安装Redis5.0.7