如果我在与 index.html 相同的目录中有一个文件 file.php:
文件.php:
<?php
echo "<body><img src=\"hi.jpg\" /><br /><p>I was here</p>"
?>
index.html:
<html>
<head></head>
<!-- I want to enter the PHP in file.php here --></body>
</html>
如何将 file.php 放入 index.html 中?
最佳答案
将 index.html
重命名为 index.php
,并填写以下内容:
<html>
<head></head>
<?php
require('./file.php');
?>
</html>
关于php - 如何在 HTML 中运行 PHP?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6324098/