<?php ?>
标签来嵌入PHP代码,实现动态生成内容,例如:<!DOCTYPE html>
<html>
<head>
<title>PHP与HTML5结合示例</title>
</head>
<body>
<h1><?php echo "Hello, World!"; ?></h1>
</body>
</html>
<?php
echo "<!DOCTYPE html>";
echo "<html>";
echo "<head>";
echo "<title>PHP与HTML5结合示例</title>";
echo "</head>";
echo "<body>";
echo "<h1>Hello, World!</h1>";
echo "</body>";
echo "</html>";
?>
include
语句来引入HTML文件,实现代码的模块化和复用,例如:<?php
include 'header.html';
echo "<h1>Hello, World!</h1>";
include 'footer.html';
?>
echo
函数输出HTML标签,实现动态生成HTML内容,例如:<?php
echo "<h1>Hello, World!</h1>";
?>