答案 0 :(得分:2)
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 } ?>