Do I need a !DOCTYPE declaration in a php file with html?

前端 未结 10 1200
面向向阳花
面向向阳花 2020-12-15 03:16

I have a php file with my website content in it. The file needs to be .php because i get some variables first and then use it later in the website content. Like this example

10条回答
  •  自闭症患者
    2020-12-15 03:28

    When they contain embedded HTML, it's better to think of .php files as regular HTML files which the server has been instructed to scan for dynamic (PHP) code.

    A valid !DOCTYPE declaration is still necessary for the document to be semantic.

提交回复
热议问题