Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Can html execute the php method?

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report