Executing HTML as PHP
When I try to embed PHP into an HTML file, it doesn't work. I edited my .htaccess so that it treats HTML file开发者_如何学Gos as PHP, but when I try to visit the .html file my browser downloads it instead of parsing and displaying it.
EDIT: My .htaccess contents:
AddType application/x-httpd-php .html
Try:
AddType application/x-httpd-php .php .html
RemoveHandler .php .html
<FilesMatch "\.(php|html)$">
SetHandler x-httpd-php
</FilesMatch>
EDIT:
Depending on your host, you may need to modify it a bit such as:
AddType application/x-httpd-php5 .php .html
RemoveHandler .php .html
<FilesMatch "\.(php|html)$">
SetHandler x-httpd-php5
</FilesMatch>
OR
AddType php5-script .php .html
RemoveHandler .php .html
<FilesMatch "\.(php|html)$">
SetHandler php5-script
</FilesMatch>
精彩评论