php - Apache 服务器: can't render php and html at once

标签 php html apache ubuntu httpd.conf

我正在使用 Apache 运行 Ubuntu 服务器。 PHP 和 HTML 都可以使用各自的文件扩展名正确运行。当我尝试将 PHP 代码添加到 HTML 文件中时,当我在 httpd.conf 中使用以下内容时,它会呈现 PHP,但不会呈现 HTML

AddHandler application/x-httpd-php .html

有什么建议吗?

最佳答案

header('Content-Type: text/plain');

在 PHP 代码中并抛弃了一切!

关于php - Apache 服务器: can't render php and html at once,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9222642/

相关文章:

javascript - 原子中的代码在html中显示不同的颜色

php - 如何从表中获取增量值

php - Ubuntu 上的两个基本 PHP、Apache 问题

linux - Magento2 的 Ubuntu 网络服务器权限设置

html - 如何使用 Apache 记录页面请求?

php - 如何生成扩展自定义记录类的 Doctrine 模型/类

php - 从数据库中获取最短时间和最长时间

html - 如何使文本框靠近文本标签

Jquery 单击仅工作一次

html - 无法删除 html 中特定表格的 css 定义的表格样式