Home  >  Article  >  Backend Development  >  How to embed PHP code in HTML, embed php_PHP tutorial

How to embed PHP code in HTML, embed php_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 09:53:591211browse

How to embed PHP code in HTML, embed php

For an experienced PHP web developer, this is a very easy thing. But this is a problem for those new to the PHP programming language. So here's how to embed PHP code in regular HTML code.

Embed PHP code in regular HTML

Create a hello script named hello.php:

<html>
<head>
<title>PHP Test</title>
</head>
<body>
<&#63;php echo '<p>Hello World</p>'; &#63;>
</body>
</html>

In the above HTML code, Hello is printed in the PHP code. Writing PHP code in HTML requires the use of bb9bd6d87db7f8730c53cb084e6b4d2d tags. Integrating PHP and HTML is very simple.

We can also write more complex PHP code in HTML by using af689f0c12a0d6c13d531abc1bf17f55 tag.

More advanced code examples:

<html>
<head>PHP HTML Integration</head>
<body>
<ul> <&#63;php for($i=1;$i<=5;$i++){ &#63;> <li>Item No <&#63;php echo $i; &#63;></li> <&#63;php } &#63;> </ul>
</body>
</html>

Output result:

Item No 1
Item No 2
Item No 3
Item No 4
Item No 5

The above is the entire content of this article, I hope you all like it.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/998807.htmlTechArticleHow to embed PHP code in HTML, embed php For an experienced PHP web developer, this is a Very easy thing. But for those who are new to the PHP programming language...
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