Home >Backend Development >PHP Problem >What should I do if the php code inserted into html does not execute?

What should I do if the php code inserted into html does not execute?

王林
王林Original
2020-08-17 13:19:536741browse

Solution to the problem of inserting php code into html that does not execute: First open the httpd.conf configuration file; then add content [AddType application/x-httpd-php .php .html] to the file.

What should I do if the php code inserted into html does not execute?

Question:

(Recommended tutorial: php graphic tutorial)

Insert php code into the html file, and php does not interpret and execute it after running.

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>测试</title>
    </head>
    <body>
    <h1>hello</h1>

        <?php
            $a=array("Dog","Cat","Horse");
            print_r($a);
        ?>
    </body>
</html>

Solution:

(Video tutorial recommendation: php video tutorial)

Open the configuration file httpd.conf and add the following content to the file That’s it.

AddType application/x-httpd-php .php .html

The above is the detailed content of What should I do if the php code inserted into html does not execute?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn