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

后端 未结 12 2109
栀梦
栀梦 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:54

    Add this line

    AddHandler application/x-httpd-php .html
    

    to httpd.conf file for what you want to do. But remember, if you do this then your web server will be very slow, because it will be parsing even static code which will not contain php code. So the better way will be to make the file extension .phtml instead of just .html.

提交回复
热议问题