Home  >  Article  >  Backend Development  >  如何在HTML中嵌入PHP 代码_PHP教程

如何在HTML中嵌入PHP 代码_PHP教程

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

如何在HTML中嵌入PHP 代码

   对于一个有经验的 PHP Web 开发者,这是一件非常容易的事情。但是对于刚开始接触 PHP 编程语言的新手这就是一个问题。所以这里介绍如何在常规的 HTML 代码中嵌入 PHP 代码。

  在常规的 HTML 中嵌入 PHP 代码

  创建一个 hello 脚本,命名为 hello.php:

  ?

1

2

3

4

5

6

7

8

PHP Test

Hello World

'; ?>

  上面的 HTML 代码中,在 PHP 代码中打印 Hello。在 HTML 中编写 PHP 代码需要使用 tags。集成 PHP 和 HTML 是非常简单的事情。

  我们也可以在 HTML 中编写更复杂的 PHP 代码,需要使用 tag。

  更高级的代码示例:

  ?

1

2

3

4

5

6

PHP HTML Integration

  • Item No

  输出结果:

  ?

1

2

3

4

5

Item No 1

Item No 2

Item No 3

Item No 4

Item No 5

  以上所述就是本文的全部内容了,希望大家能够喜欢。

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/1000089.htmlTechArticle如何在HTML中嵌入PHP 代码 对于一个有经验的 PHP Web 开发者,这是一件非常容易的事情。但是对于刚开始接触 PHP 编程语言的新手这就是一个...
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