我正在嘗試file_get_contents並輸出php代碼作爲字符串而沒有正在呈現。我們的想法是抓住原始未呈現文件的內容,從而它們可以在一個textarea進行編輯...php:file_get_contents正在剝離php代碼
// file "foo.php" I'm needing the contents of
<h1>foo</h1>
<? include 'path/to/another/file' ?>
// php file that's calling the file_get_contents
<?php
echo file_get_contents('foo.php');
?>
上面的代碼被剝出的PHP包括foo.php其輸出:
<h1>foo</h1>
有誰知道我怎樣才能得到foo.php內容作爲原料未呈現字符串,其中輸出將?:
<h1>foo</h1>
<? include 'path/to/another/file' ?>
任何幫助,不勝感激!
你有沒有看到生成的源以確保內容是真的走了嗎? – Charles 2010-06-18 19:59:19
你做了什麼應該工作。我能想到的唯一情況是失敗的是,如果你訪問foo.php作爲URL(http://domain/foo.php)... – 2010-06-18 20:01:32
Doh!好的,它在源代碼中顯示,但不在DOM中? – shanebo 2010-06-18 20:02:57