我知道這聽起來很愚蠢,我實際上想讓PHP讀取另一個php文件作爲文本,因爲我不想在編輯器中打開php,我想用我的瀏覽器顯示它並使用修改JS。這是我所做的: -閱讀PHP文本
$code_to_display = "";
echo "Language Found:".count($project_lang_file)."<br>";
for ($x=0; $x < count($project_lang_file); $x++) {
$code_to_display .= readfile($project_lang_file[$x]);
//$code_to_display .= file_get_contents($project_lang_file[$x]);
echo "Displaying code for $project_lang_file[$x] <br><br>";
echo "<textarea id='myTextarea' style='color:black;'>$code_to_display</textarea><br>";
}
我試過readfile,fopen,file_get_content,沒有實際顯示它爲文本。任何人都可以幫忙
使用[高亮文件()](http://php.net/manual/en/function.highlight-file.php),它甚至會爲您添加語法高亮顏色 –
@MarkBaker也嘗試過..它顯示爲空以及...不知道爲什麼 – MuthaFury
[編輯一個PHP文件,與另一個PHP文件,使用Fwrite]可能重複(http://stackoverflow.com/questions/11146626/editing-a-php-file -with-another-php-file-using-fwrite) –