"; and finally open the web page You can see the effect."/> "; and finally open the web page You can see the effect.">

Home  >  Article  >  Backend Development  >  Can php be written in html?

Can php be written in html?

angryTom
angryTomOriginal
2019-10-17 11:41:367689browse

Can php be written in html?

Can I write php in html?

You can write php code in html, but the file suffix needs to be .php instead of .html. Otherwise, the php program will not be parsed and executed.

1. Create a new index.php file and write basic tags like writing html.

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
    <p>这是html</p>
</body>
</html>

2. Then insert the php code snippet into the html code, for example:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
    <p>这是html</p>
    <?php echo "hello"; ?>
</body>
</html>

3. Open the web page and you will see it Effect:

Can php be written in html?

For more PHP related knowledge, please visit PHP Chinese website!

The above is the detailed content of Can php be written in html?. 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