我的目标是在服务器上自动创建一个具有以下html/php文件的文件 但它包含php包含,因此当页面构建时它包含包含的所有内容也是如此。不解析的Php文件
我想要include("../includes/right.html");
独立 在生成的页面,但我希望其他PHP变量进行分析。
<?php
// Start the buffering //
ob_start();
?>
<?php echo $name; ?>
test text line one
<?php include("../includes/right.html"); ?>
test text line two
<?php
// Putting content buffer into file //
file_put_contents('mypage.html', ob_get_contents());
?>
退出'<?php include ...?>',这样PHP就不会将其解释为PHP。 –
嘿马特,不知道你的意思是逃避吗? – mark
另一个解决方案是将文件作为字符串通过单独的PHP脚本读取,然后将其回显出来。 – Appleshell