Can php be written in html?

angryTom
Release: 2023-02-27 07:00:01
Original
7789 people have browsed it

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>
Copy after login

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>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template