我的 .htaccess 文件中有包含的代码,但我尝试包含的 php 代码不起作用。
Options +Includes
AddType text/html .htm .html
AddHandler server-parsed .htm .html
AddType application/octet-stream .vcf
AddOutputFilterByType DEFLATE text/html text/htm text/plain text/css text/php text/javascript application/x-javascript
最佳答案
试试:
AddType application/x-httpd-php .html .htm
更新 1
它可能是特定于 PHP 版本的。如果您使用的是 PHP5,请尝试:
AddType application/x-httpd-php5 .html .htm
更新 2
试试:
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html
或者这里还有另一种方法:
<FilesMatch "\.html$">
ForceType application/x-httpd-php
</FilesMatch>
关于php - 服务器不将 .html 解析为 PHP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6295141/