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:
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!