最佳答案
更新:
OP 似乎在询问如何将呈现的 PHP+HTML 代码放入文本文件中?
//get the output from the file
ob_start();
include "yourphpplushtml.php";
$output = ob_get_clean();
//now create a text file and write to it
$fp = fopen('data.txt', 'w+');
fwrite($fp, $output); //put the output
fclose($fp); //close the handler
//Or put it into the textare
echo '<textarea>'.$output.'</textarea>';
上一个答案但也可能对其他人有帮助
HTML 可以通过多种方式与 PHP 结合
直接从 PHP 输出 HTML
<?php echo "<head><title>my new title</title></head>"; ?>
在您的 HTML 中包含 PHP
<title><?php echo $dynamictitle; ?></title>
或者甚至用老式的复杂方式将它们分开
<?php if($resultFound == true) { ?> <p> The result was successfully found.</p> <?php } ?>
关于php - 如何将渲染后的 PHP+HTML 代码导入到文本文件中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9866715/