如何在HTML文件中运行PHP脚本? [英] How can I run a PHP script inside a HTML file?

查看:546
本文介绍了如何在HTML文件中运行PHP脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 .html文件中运行简单的PHP代码?

How can I run simple PHP code inside a .html file?

推荐答案

要在"html"或"htm"中执行"php"代码, 对于"Apache版本2.4.23"

To execute 'php' code inside 'html' or 'htm', for 'apache version 2.4.23'

转到"/etc/apache2/mods-enabled" 编辑"@ mime.conf"

Go to '/etc/apache2/mods-enabled' edit '@mime.conf'

转到文件末尾,然后 添加以下行:

Go to end of file and add the following line:

 "AddType application/x-httpd-php .html .htm"

在标记<之前" /ifModules>' 经过"apache 2.4.23"验证和测试 和'php 5.6.17-1' 在"debian"下

BEFORE tag '< /ifModules >' verified and tested with 'apache 2.4.23' and 'php 5.6.17-1' under 'debian'

这篇关于如何在HTML文件中运行PHP脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆