How do I add PHP code/file to HTML(.html) files?

后端 未结 12 2268
栀梦
栀梦 2020-11-21 22:05

I can\'t use PHP in my HTML pages. For example, index.html. I\'ve tried using both:

 

and



        
12条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-21 22:39

    For having .html files parsed as well, you need to set the appropriate handler in your server config.

    For Apache httpd 2.X this is the following line

    AddHandler application/x-httpd-php .html
    

    See the PHP docu for information on your specific server installation.

提交回复
热议问题