If I create a simple .html file with a table inside 开发者_高级运维it. Within one of the columns of a table, if I insert PHP opening and closing tags, and even just type echo, it is not working. Do I need to change the extension of the file to .php?
Changing the file to .php would be the quickest solution.
An alternate solution would be to use Apache's addType to allow apache to serve PHP pages with a different extension.
AddType application/x-httpd-php .html .htm
Yes, in most cases.
The webserver needs to know it has to process the file through the php processor, instead of just giving it to the user as is the default for a .html file. So renaming to .php is the easiest way to get that.
If you use AddType, then all html files are going through the php processor, which might slow things down too much.
精彩评论