【问题标题】:Run current file as PHP script将当前文件作为 PHP 脚本运行
【发布时间】:2016-03-25 11:47:53
【问题描述】:

有没有办法在 Visual Studio Code 中将当前 *.php 文件作为 PHP 脚本运行?我发现的信息表明,如果您安装 Xdebug,您可以调试代码,但感觉很奇怪,您不能只运行代码。

(这是 2000 年左右所有编辑器的标准功能,但现在越来越难找到......)

【问题讨论】:

    标签: php windows visual-studio-code


    【解决方案1】:

    我会说编辑器没有这样的功能,因为有一个实现它的第三方扩展......你需要安装Runner。然后,Ctrl+Shift+ROutput 窗格中启动脚本:

    PHP配置out of the box:

    const defaultLanguageMap = {
      bat: '',
      clojure: 'clj',
      go: 'go run',
      javascript: 'node',
      lua: 'lua',
      perl6: 'perl6',
      perl: 'perl',
      php: 'php',
      powershell: 'powershell -noninteractive -noprofile -c -',
      python: 'python',
      r: 'Rscript',
      ruby: 'ruby',
      shell: 'bash',
      typescript: 'tsc'
    };
    

    【讨论】:

      猜你喜欢
      • 2019-04-15
      • 1970-01-01
      • 2011-01-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多