Get the App
SLTechnology News&Howtos  ›  Development  › 

Can html execute the php method?

Shulou Source: shulou.com Published: 2022-06-03 12:22:48 11月15日 Update

This article mainly introduces whether html can implement the php method, the article is very detailed, has a certain reference value, interested friends must read it!

Html can execute the php method, which is as follows: 1. Modify the httpd.conf file and order Apache to treat HTML as a PHP;2 and modify .htaccess.

This article operating environment: Windows7 system, PHP5 version, Dell G3 computer

Can html execute the php method?

The method of executing php statement in static html File

The PHP statement in the HTM file will not be executed. How can I run the php code in the HTML file?

The method that the html file executes the php statement:

1. Modify httpd.conf and order Apache to treat HTML as PHP

The http.conf file in the server needs to be modified.

Add the following statement to the httpd.conf of Apache:

AddType application/x-httpd-htm .htmAction application/x-httpd-htm "/ php4/php.exe"

For a general virtual host, we can't modify httpd.conf, but we can do it by modifying .htaccess.

2, modify .htaccess

NEW PHP Add HandlersSolutionIf you need an add handler for PHP please use the following:#PHP5AddHandler application/x-httpd-php5 .html .htm # PHP4AddHandler application/x-httpd-php4 .html .htmThat is if you need to parse .html files or any other extension as PHP you can place that in your .htaccess file. These are all the contents of the article "can html execute the php method". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Methods files statements content commands articles hosts codes values interests can be passed through guys partners more servers environments computers knowledge systems virtual hosts Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Huawei MariaDB Shulou Information vpn