简体   繁体   English

如何使visual studio突出显示.php文件

[英]How can I make visual studio highlight .php files

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. 希望标题解释一切,但我想要做的就是在我的网站解决方案中打开一些.php文件,让Visual Studio将它们视为html文件。 I don't need the actual PHJP code highlighted (it's only includes). 我不需要突出显示实际的PHJP代码(它只包含)。 The HTML syntax should be parse-able, should it not? 如果不是,HTML语法应该是可解析的?

Tools -> Options -> Text Editor -> File Extension 工具 - >选项 - >文本编辑器 - >文件扩展名

in the Extension box, put .php. 在扩展框中,输入.php。 For the Editor, you can select HTML Editor. 对于编辑器,您可以选择HTML编辑器。 Click Add, then OK 单击添加,然后单击确定

You can also install the PHP Tools for Visual Studio add-in. 您还可以安装Visual Studio加载项的PHP工具。 Tools > Extension and Updates and then search for PHP online. 工具>扩展和更新,然后在线搜索PHP。 Your first result should be this add-in. 你的第一个结果应该是这个加载项。

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

If you want intellisense, debug, and other advanced functionality, you could get the php ide for VS 如果你想要智能感知,调试和其他高级功能,你可以获得VSphp ide

If all you need is syntax highlighting, check out this link. 如果您只需要语法高亮显示,请查看链接。 It's what I'm currently using, but doesn't have all the goodies of vs.php. 这是我目前正在使用的,但没有vsphp的所有好处。

安装Phalanger

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 solution didn't work and Miguel's solution needs PHP Tools which is free for 30 days but then you need to activate it. 对我来说, Josh的解决方案不起作用, Miguel的解决方案需要30天免费的PHP工具,但是你需要激活它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 Visual Studio Code 中使用 HTML 标记格式化 PHP 文件? - How can I format PHP files with HTML markup in Visual Studio Code? 如何向Visual Studio 2010添加PHP支持? - How can I add PHP support to Visual Studio 2010? 如何将php文件添加到Visual Studio项目中? - How to add php files to visual studio project? 有没有办法让 Visual Studio Code 识别 PHP 文件中的 HTML 语法 - Is there a way to make Visual Studio Code recognize HTML syntax in PHP files 如何使用php从多个.csv文件中获取数据,然后编译该数据并进行交互式可视化表示它们? - How can I use php to get data from multiple .csv files, then compile that data and make an interactive visual to represent them? 如何让 PHP 认为文件在父目录中? - How can I make PHP think that the files are in a parent directory? 如何在Visual Studio中的php项目之间共享文件? - How to share files between php projects in visual studio? Visual Studio代码:如何制作要插入的代码段<?php ?> - Visual Studio Code: How to make a snippet for inserting <?php ?> 如何语法突出显示PHP中exec()函数的输出? - How can I syntax highlight the output from the exec() function in PHP? 如何禁用PhpStorm中的PHP echo高亮显示? - How can I disable the highlight of PHP echo in PhpStorm?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM