iis服务器助手广告广告
返回顶部
首页 > 资讯 > 后端开发 > PHP编程 >VS CODE 配置 live server 和 Open PHP/HTML/JS In Browser 和PHP debug 及 javascript debugger 和launch.json 及
  • 746
分享到

VS CODE 配置 live server 和 Open PHP/HTML/JS In Browser 和PHP debug 及 javascript debugger 和launch.json 及

phpjavascripthtml 2023-10-21 09:10:39 746人浏览 薄情痞子
摘要

VS CODE 配置 live server 和 Open PHP/html/js In Browser 和php debug 及 javascript debugger 和launch.JSON 及settings.josn 实现了 非常

VS CODE 配置 live server 和 Open PHP/html/js In Browser 和php debug 及 javascript debugger 和launch.JSON 及settings.josn 实现了 非常方便的 HTML 和PHP 及 JS 实时调试。文件如下。

安装的插件如下:全都需要装,不要少

 

调试HTML用live server  实时显示调试。调试HTML 内外链的JS 时,要先启用live server 再 用"F5 JS HTML Launch Chrome against localhost 后,直接按 F5打开chrom.

先配置PHP 调试环境

    "php.validate.executablePath":"D:\\phpstudy_pro\\Extensions\\php\\php7.3.4nts\\php.exe",    "php.debug.executablePath": "D:\\phpstudy_pro\\Extensions\\php\\php7.3.4nts\\ext\\php_xdebug.dll",

再配置  code-runner 支持PHP和html 用360以绝对路径打开。

    "code-runner.executORMap": {        "php": "D:\\phpstudy_pro\\Extensions\\php\\php7.3.4nts\\php.exe",        "html": "\"C:\\Users\\Administrator\\AppData\\Roaming\\360se6\\Application\\360se.exe\"",

open-php-html-js-in-browser 的配置。用Chrom以localhost网址打开。

    "open-php-html-js-in-browser.documentRootFolder": "D:/phpstudy_pro/WWW/",    "open-php-html-js-in-browser.selectedBrowser": "Chrome",

liveServer的配置关键点 

    "liveServer.settings.host": "localhost",    "liveServer.settings.CustomBrowser": "chrome",

 

各自的界面 设置 

liveserver 工作区 主要设置  localhost 和chrome

 open-php-html-js-in-browser主要设置,打开URL 和本地绝对路径及打开浏览器为Chrome

 

settings.json 配置文件如下。

{    "php.validate.executablePath":"D:\\phpstudy_pro\\Extensions\\php\\php7.3.4nts\\php.exe",    "php.debug.executablePath": "D:\\phpstudy_pro\\Extensions\\php\\php7.3.4nts\\ext\\php_xdebug.dll",    "code-runner.saveFileBeforeRun": true,    "code-runner.executorMap": {        "php": "D:\\phpstudy_pro\\Extensions\\php\\php7.3.4nts\\php.exe",        "html": "\"C:\\Users\\Administrator\\AppData\\Roaming\\360se6\\Application\\360se.exe\"",        "javascript": "node",        "java": "cd $dir && javac $fileName && java $fileNameWithoutExt",        "c": "cd $dir && GCc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",        "cpp": "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",        "objective-c": "cd $dir && gcc -framework Cocoa $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",      //  "php": "php",        "python": "Python -u",        "perl": "perl",        "perl6": "perl6",        "ruby": "ruby",        "Go": "go run",        "lua": "lua",        "groovy": "groovy",        "powershell": "powershell -ExecutionPolicy ByPass -File",        "bat": "cmd /c",        "shellscript": "bash",        "fsharp": "fsi",        "csharp": "scriptcs",        "vbscript": "cscript //Nologo",        "typescript": "ts-node",        "coffeescript": "coffee",        "Scala": "scala",        "swift": "swift",        "julia": "julia",        "crystal": "crystal",        "ocaml": "ocaml",        "r": "Rscript",        "applescript": "osascript",        "clojure": "lein exec",        "haxe": "haxe --cwd $dirWithoutTrailingSlash --run $fileNameWithoutExt",        "rust": "cd $dir && rustc $fileName && $dir$fileNameWithoutExt",        "racket": "racket",        "scheme": "csi -script",        "ahk": "autohoTKEy",        "autoit": "autoit3",        "dart": "dart",        "pascal": "cd $dir && fpc $fileName && $dir$fileNameWithoutExt",        "d": "cd $dir && dmd $fileName && $dir$fileNameWithoutExt",        "haskell": "runhaskell",        "nim": "nim compile --verbosity:0 --hints:off --run",        "lisp": "sbcl --script",        "kit": "kitc --run",        "v": "v run",        "sass": "sass --style expanded",        "sCSS": "scss --style expanded",        "less": "cd $dir && lessc $fileName $fileNameWithoutExt.css",        "FortranFreeForm": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",        "fortran-modern": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",        "fortran_fixed-form": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",        "fortran": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",        "sml": "cd $dir && sml $fileName"    },    "open-php-html-js-in-browser.documentRootFolder": "D:/phpstudy_pro/WWW/",    "open-php-html-js-in-browser.selectedBrowser": "Chrome",    "editor.renderWhitespace": "all",    "editor.unicodeHighlight.ambiguousCharacters": false,    "debug.javascript.autoAttachFilter": "always",    "liveServer.settings.host": "localhost",    "liveServer.settings.CustomBrowser": "chrome",}

launch.json 文件 配置了三种方式的调试 node.js 在VS输入调试。PHP的 debug 和 F5键直接调试HTML外链的JS   端口号要设置的跟live server一致。

{    // 使用 IntelliSense 了解相关属性。     // 悬停以查看现有属性的描述。    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387    "version": "0.2.0",    "configurations": [        {            "name": "Launch JS Program",            "program": "${workspaceFolder}/${relativeFileDirname}/${fileBasename}",            "request": "launch",            "skipFiles": [                "/**"            ],            "type": "node"        },        {            "name": "监听 Xdebug open PHP",            "type": "php",            "request": "launch",            "port": 9000        },        {            "type": "chrome",            "request": "launch",            "name": "F5 JS HTML Launch Chrome against localhost",            "url": "Http://localhost:5500/${relativeFileDirname}/${fileBasename}",            "WEBRoot": "${workspaceFolder}"        },    ]}

来源地址:https://blog.csdn.net/sitonn/article/details/128179838

--结束END--

本文标题: VS CODE 配置 live server 和 Open PHP/HTML/JS In Browser 和PHP debug 及 javascript debugger 和launch.json 及

本文链接: https://www.lsjlt.com/news/433515.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作