我的目標是在服務器上自動創建一個具有以下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