简体   繁体   English

Apache2 Web服务器不在HTML页面内执行PHP代码

[英]Apache2 Web Server Isn't Executing PHP Code inside HTML Page

I can execute PHP code fine if I name the file *.php and load it in Chromium through the localhost address. 如果我将文件命名为* .php并通过localhost地址将其加载到Chromium中,我可以很好地执行PHP代码。

If I try to insert PHP inside a file named *.html, the PHP no longer executes. 如果我尝试在名为* .html的文件中插入PHP,则PHP不再执行。

Code: http://pastebin.com/LgCzMs02 代码: http//pastebin.com/LgCzMs02

Output: http://imgur.com/0CO5S 输出: http//imgur.com/0CO5S

除非您为PHP 处理程序更新Apache配置以包含html扩展名,否则扩展名必须是php

包含php文件的程序应该具有* .php的扩展名,除非您在加载期间将index.html重定向到* .php页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM