PHP syntax check on .html files in NetBeans

2019-04-15 02:51发布

I am using NetBeans IDE 8.0.1 for my PHP development.

I like the syntax check feature in netbeans. But the problem that I have is that it only works with files that have .php extension .

I am using a lot of php code in files with .html extension, and no php syntax checking is being available in NetBeans for those files.

Is it possible to enable php syntax checking for .html files?

2条回答
Evening l夕情丶
2楼-- · 2019-04-15 03:14

One hacky way to do that:

  • go to Tools|Options|Miscellanous
  • select Files tab
  • from File extensions, select HTML
  • from Associated MIME type, select text/x-php5

Then NetBeans will consider all HTML files as PHP ones

查看更多
虎瘦雄心在
3楼-- · 2019-04-15 03:25

Well if your files have .html extension then it will never be able to execute the php code and to execute php code the extension must be .php as PHP stands for Hypertext Pre-processor so it is processed before HTML.

查看更多
登录 后发表回答