Use of php Include in html files

与世无争的帅哥 提交于 2019-12-01 10:44:15

Try using this:

AddHandler x-httpd-php5-cgi .html

See here: http://httpd.apache.org/docs/2.2/mod/mod_mime.html#addhandler

All you have to do is change all of the files you are including it to .php files. It will not affect them negatively just the browser will then know to interpret it the php.

All your formatting will still be valid.

If you use <?php include ... ?> inside an HTML file it won't work. Reason? If the file has a .html extension, the browser will not be expecting PHP, so it won't do anything. If you have any PHP code in any file, give that file a .php extension. (Unless you have a specific reason for not doing this...?)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!