简体   繁体   English

Visual Web Developer中的PHP语法高亮?

[英]PHP syntax highlighting in Visual Web Developer?

I recently installed PHP 5 on IIS, however, I am unable to find a PHP syntax highlighting plug-in or extension for VWD. 我最近在IIS上安装了PHP 5,但是,我无法找到突出显示VWD插件或扩展的PHP语法。 Where can I find a plug-in? 我在哪里可以找到插件? I thought there was an official one. 我以为有一个正式的。

Consider PHP IDE for Visual Studio. 考虑用于Visual Studio的PHP IDE。

http://www.jcxsoftware.com/vs.php http://www.jcxsoftware.com/vs.php

I have used this and it adds a lot of nice PHP specific features to Visual Studio. 我使用过它,它为Visual Studio添加了许多不错的PHP特性。

From their site... 从他们的网站......

Editor and File Management 编辑和文件管理

•PHP4 and PHP5 Support •PHP4和PHP5支持

•Syntax Coloring for PHP, Smarty, HTML, JavaScript, CSS, XML and XSLT •PHP,Smarty,HTML,JavaScript,CSS,XML和XSLT的语法着色

•File templates for PHP, Smarty, HTML, JavaScript, CSS, XML and XSLT •PHP,Smarty,HTML,JavaScript,CSS,XML和XSLT的文件模板

•Intellisense for PHP, Smarty, HTML, JavaScript, CSS, XML and XSLT •PHP,Smarty,HTML,JavaScript,CSS,XML和XSLT的Intellisense

Debugging 调试

•XDebug and DBG support •XDebug和DBG支持

•Debug PHP, JavaScript and .Net in one single session •在一个会话中调试PHP,JavaScript和.Net

•Built-in Apache web server for ease of debugging. •内置Apache Web服务器,易于调试。 Preconfigured with Php4, Php5, XDebug and DBG. 预配置Php4,Php5,XDebug和DBG。

I've tried a lot of text editors, some free, some commercial. 我尝试了很多文本编辑器,一些是免费的,一些是商业编辑器。 So far Visual Studio is the only one that has the right combination of features to be most useful to me. 到目前为止,Visual Studio是唯一一个具有正确功能组合的人,对我来说最有用。 So, coding PHP in VS is important to me. 因此,在VS中编写PHP对我来说非常重要。

You can trick Visual Studio (and hopefully also Visual Web Developer) into thinking .php files are C++ with a registry hack. 你可以欺骗Visual Studio(希望也是Visual Web Developer),认为.php文件是带有注册表黑客的C ++。 The syntax highlighting is close enough to be useful. 语法高亮非常接近有用。

This blog post explains how to do it for all versions of VS: http://blog.cumps.be/visual-studio-2008-and-php-coloring/ 这篇博客文章解释了如何为VS的所有版本执行此操作: http//blog.cumps.be/visual-studio-2008-and-php-coloring/

I don't know about older versions, but VWD 2010 allows you to link any extension to any type of formatting in its options. 我不知道旧版本,但VWD 2010允许您将任何扩展名链接到其选项中的任何类型的格式。

Tools->Options 工具 - >选项

click 'show all options' 点击'显示所有选项'

Expand 'Text editor' 展开“文字编辑器”

click on 'file extensions' 点击'文件扩展名'

type in 'php' and select how you want it to be formatted (I recommend the Automatic Editor Selector), click Add 输入'php'并选择您希望如何格式化(我推荐自动编辑器选择器),单击添加

And there you go! 你去吧! Next time you load the page you will see the changes. 下次加载页面时,您将看到更改。 If you don't like it, there's 20 other styles to choose from. 如果你不喜欢它,还有20种其他款式可供选择。

There is no official plugin for PHP for Visual Web Developer. PHP for Visual Web Developer没有官方插件。 I believe that this is because Microsoft would rather you use their .NET products, (notably ASP) which serves most of if not all of (I can't exactly say as I don't really use ASP as much as PHP) of the functionality of PHP. 我相信这是因为微软宁愿你使用他们的.NET产品(特别是ASP),这些产品服务于大部分(如果不是全部)(我不能完全说,因为我没有像PHP那样真正使用ASP) PHP的功能。

There are however, some very good PHP IDEs out there. 但是,有一些非常好的PHP IDE。 A list of which you Here 在这里的清单

thx,我使用“HTML格式”的最后一篇文章而不是“自动编辑器选择器”

I would recommend Visual Studio with this Extension : http://phalanger.codeplex.com/ 我建议使用此扩展程序的Visual Studio: http//phalanger.codeplex.com/

It is free and gives you more functionality than most of the expensive tools. 它是免费的,并提供比大多数昂贵的工具更多的功能。

I would recommend using Netbeans . 我建议使用Netbeans It has code completion for PHP and runs xdebug for debugging. 它具有PHP的代码完成功能,并运行xdebug进行调试。 I've been using it for over a year and the support for PHP just keeps getting better. 我已经使用它超过一年了,对PHP的支持一直在变得越来越好。

Definitely worth trying. 绝对值得一试。

if you're using windows there's an application called notepad++ that will do syntax highlighting for dozens of languages. 如果您正在使用Windows,那么会有一个名为notepad ++的应用程序,它将为几十种语言进行语法高亮显示。 I used it for C but I know it has a php syntax highlighter and many more languages coming along. 我用它来做C但我知道它有一个PHP语法荧光笔和更多的语言出现。 Check it out on sourceforge. 在sourceforge上查看它。 If your using Linux or Unix you can use K Advanced Text Editor (kate). 如果您使用的是Linux或Unix,则可以使用K高级文本编辑器(kate)。 It also has a console window built in. 它还内置了一个控制台窗口。

What I am looking is for a debugger for PHP that is as useful as the one built into Visual Studios. 我正在寻找的是一个PHP的调试器,它与Visual Studio内置的调试器一样有用。 I searched high and low for this and there seems to be none that works well. 我为此寻找高低,似乎没有一个效果很好。

The closest Visual Studio like PHP environment I have found yet is CodeLobster . 我发现的最接近Visual Studio的PHP环境是CodeLobster It has a free version for PHP and CSS, as well as for pay versions that include for the Pro version a plug-in for CakePHP, CodeIgniter, Drupal, Facebook, JQuery, Joomla, Smarty, Symfony, WordPress and Yii. 它有PHP和CSS的免费版本,以及支持版本,包括用于CakePHP,CodeIgniter,Drupal,Facebook,JQuery,Joomla,Smarty,Symfony,WordPress和Yii的Pro版本的插件。

It isn't perfect, but it is pretty good and free for the basic version. 它并不完美,但对于基本版本来说它是相当不错且免费的。

What I used is the PHP Designer 2007 - Personal Version 5.0.2 is a fully functional php editor, for free! 我使用的是PHP Designer 2007 - Personal Version 5.0.2是一个功能齐全的php编辑器,免费! from mpsoftware[dot]dk/, however I like using MSVWD a lot too, and now that I've seen how to make php files work in it, I gonna stick with that! 来自mpsoftware [dot] dk /,但是我也喜欢使用MSVWD,现在我已经看过如何让php文件在其中工作,我会坚持下去! Thanks! 谢谢!

btw Aptana Studio looks promising too tho 顺便说一句, Aptana Studio看起来很有前途

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM