PHP :html中直接运行php代码, Parsing .html as PHP in .htaccess for Apache 2.4

直接设置 .htaccess文件

之前用的是:

Options +ExecCGI
AddType application/x-httpd-php5-3 .htm .html .php
AddHandler x-httpd-php5-3 .htm .html .php

但是最近发现失效,改用下面方法:

 <FilesMatch "\.html$">
  SetHandler application/x-httpd-php
</FilesMatch>

 

现在可以直接在html文件中书写php代码了!

 

本文:PHP :html中直接运行php代码, Parsing .html as PHP in .htaccess for Apache 2.4

Loading

Add a Comment

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.