问题描述
我使用Notepad ++进行PHP编辑,同时回显了HTML标记. Notepad ++始终突出显示并与HTML,CSS,Javascript和PHP代码在同一文档中进行交互.
I've used Notepad++ for PHP editing with HTML tags echoed out. Notepad++ had always highlighted, and interacted with the HTML, CSS, Javascript, and PHP code all in the same document.
最新版本似乎仅突出显示PHP代码,而其余所有代码(如HTML,CSS,Javscript)则变灰并聚在一起.
The latest versions seem to only highlight PHP code only, and all the rest of the code be it HTML, CSS, Javscript just gets greyed out, and bunched together.
这是html和javascript外观的屏幕截图.将语言从菜单栏切换到PHP,HTML或Javascript并不会改变任何内容.
Here's the screenshot of how the html and javascript look. Switching the language from the menu bar to PHP, HTML, or Javascript doesn't change anything though.
有什么办法可以再次启用此功能?
Is there any way to enable this feature again?
推荐答案
看截图,看来您的标记全都在被回显的字符串中.在这种情况下,Notepad ++可以正常工作,将整个字符串突出显示为PHP字符串.
Looking at the screenshot, it seems your markup is all in a string that's being echoed out. In that case, Notepad++ is acting normally, highlighting the entire string as a PHP string.
请记住,您无需使用echo
即可打印HTML.您可以使用PHP的打开和关闭定界符将PHP嵌入HTML(或HTML嵌入HTML)中,以在文件中的任意位置中断并返回到PHP代码(请参见手册).如果用?>
而不是echo "
关闭PHP代码,然后用<?php
而不是";
在字符串的末尾重新打开它,则HTML应该再次突出显示为HTML.
Remember that you don't need to use echo
to print HTML. You can embed PHP in HTML (or HTML in PHP) by using PHP's opening and closing delimiters to break out and back in to PHP code anywhere in your files (see the manual). If you close your PHP code with ?>
rather than use echo "
, and open it back up at the end of the string with <?php
instead of ";
, your HTML should highlight as HTML again.
这篇关于无论如何,Notepad ++可以同时突出显示PHP和HTML吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!