Web 浏览器未将 PHP 代码作为 PHP 代码处理

2021-12-25 00:00:00 browser php html joomla

我的计算机上安装了 Joomla,但最近一直在编写与 Joomla 管理的站点无关的 php 文件.出于某种原因,当我尝试使用 xampp 在网络浏览器中打开这些 php 文件时(注意:Joomla 也在使用 xampp),浏览器不会将标签中的代码作为 php 代码处理.

I have Joomla installed in my computer, but recently have been writing php files that aren't related to the Joomla-managed site. For some reason, when I try to open those php files in the web browser using xampp (note: Joomla also is using xampp), the browser doesn't process the code w/in the tags as php code.

例如,在网页浏览器中打开一个基本页面(标题为test"的页面,除body标签外没有其他内容)并转到源代码后,在源代码中显示以下内容:

For example, after opening a basic page (a page with title "test", no content except in the body tags) in the web browser and going to the source code, the following is shows up in the source code:

<body>
<?php echo "hello"; ?>

</body>

而不是 HTML 转换.(即只是你好")

instead of the HTML conversion. (i.e. just "hello")

有人知道这里发生了什么吗?

Does anyone have an idea about what's going on here?

谢谢.

推荐答案

这可能是因为您的 apache 中没有加载 PHP 模块.确保它已启用

It's probably because PHP module isn't loaded in your apache. Be sure it is enabled

相关文章