Is there anyway to have Notepad++ highlight both PHP and HTML at the same time?

前端 未结 2 1792
青春惊慌失措
青春惊慌失措 2021-01-19 17:53

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 sam

2条回答
  •  说谎
    说谎 (楼主)
    2021-01-19 18:39

    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.

    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 instead of ";, your HTML should highlight as HTML again.

提交回复
热议问题