The PHP statements in the general HTML file will not be executed, so what is the way to run the PHP code in the HTML file? Small series for everyone to find a few ways, hope to help everyone.
HTML file method for executing PHP statements:
1, modify httpd.conf, command Apache to take HTML as PHP,
The http.conf file in the server needs to be modified.
In Apache httpd.conf, add the following statement:
AddType application/x-httpd-htm. Htmaction application/x-httpd-htm "/php4/php.exe"
General web Hosting, we cannot modify httpd.conf, but we can do it by modifying the. htaccess.
2, modify. htaccess
NEW PHP Add handlerssolutionif You need a ADD handler for PHP * Use the following: #PHP5AddHandler application/x-http D-php5. html. Htm#php4addhandler application/x-httpd-php4. html. Htmthat is if you need to parse. html files or any other Extension as PHP can place the in your. htaccess file.
The above static HTML file to execute the PHP statement method is the whole content, it looks very simple, I hope to give you a reference.
For more HTML and PHP related issues, you can access the PHP Chinese web.