visual-studio 如何使 Visual Studio 突出显示 .php 文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1196253/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I make visual studio highlight .php files
提问by feihtthief
Hope the title explains it all, but all I'm trying to do is open some .php files in my web-site solution and have Visual studio treat them as if they are html files. I don't need the actual PHJP code highlighted (it's only includes). The HTML syntax should be parse-able, should it not?
希望标题能解释这一切,但我要做的就是在我的网站解决方案中打开一些 .php 文件,并让 Visual Studio 将它们视为 html 文件。我不需要突出显示实际的 PHJP 代码(它只包括在内)。HTML 语法应该是可解析的,不是吗?
采纳答案by bitcoinero
You can also install the PHP Tools for Visual Studio add-in. Tools > Extension and Updates and then search for PHP online. Your first result should be this add-in.
您还可以安装 PHP Tools for Visual Studio 加载项。工具 > 扩展和更新,然后在线搜索 PHP。您的第一个结果应该是这个加载项。
If not, you can get it from here:
如果没有,您可以从这里获取:
http://visualstudiogallery.msdn.microsoft.com/6eb51f05-ef01-4513-ac83-4c5f50c95fb5
http://visualstudiogallery.msdn.microsoft.com/6eb51f05-ef01-4513-ac83-4c5f50c95fb5
回答by Josh E
Tools -> Options -> Text Editor -> File Extension
工具 -> 选项 -> 文本编辑器 -> 文件扩展名
in the Extension box, put .php. For the Editor, you can select HTML Editor. Click Add, then OK
在扩展框中,输入 .php。对于编辑器,您可以选择 HTML 编辑器。点击添加,然后确定
回答by Rado
If you want intellisense, debug, and other advanced functionality, you could get the php ide for VS
如果你想要智能感知、调试和其他高级功能,你可以获得VS的 php ide
If all you need is syntax highlighting, check out thislink. It's what I'm currently using, but doesn't have all the goodies of vs.php.
如果您只需要语法高亮,请查看此链接。这是我目前使用的,但没有 vs.php 的所有优点。
回答by WhiteFangs
If you're using VS2013 or older, I would recommend this extension for PHP Language support : https://visualstudiogallery.msdn.microsoft.com/2a10ba81-26c5-47d9-939b-6bcc7bbec251
如果您使用的是 VS2013 或更早版本,我会推荐此扩展以支持 PHP 语言:https://visualstudiogallery.msdn.microsoft.com/2a10ba81-26c5-47d9-939b-6bcc7bbec251
For me Josh's solutiondidn't work and Miguel's solutionneeds PHP Tools which is free for 30 days but then you need to activate it.
对我来说,Josh 的解决方案不起作用,而Miguel 的解决方案需要 PHP 工具,该工具可免费使用 30 天,但随后您需要激活它。

