-1
代碼片段中描述的PHP行爲的原因是什麼?PHP行爲:爲什麼PHP標籤中的代碼不顯示在屏幕上?
// "demo.txt" is a plain text file.
// Content is read into a string.
$demo = file_get_contents('http://example.com/demo.txt');
// Browser displays the content of the text-file.
echo $demo;
// "functions.php" is a php-file.
// Read into a string.
$demo = file_get_contents('http://example.com/functions.php');
// Browser displays nothing.
echo $demo;
什麼行爲? – Damodaran
當提出問題時,請提供一個具體示例,說明您正在嘗試實現的目標以及您目前所做的工作。要詳細瞭解如何提出重要問題,請參閱如何提問 - http://stackoverflow.com/questions/如何提問 – Damodaran
當您通過HTTP請求PHP文件時,它通常由服務器進行分析,因此您將獲得的唯一輸出是PHP腳本生成的輸出(如果有的話)。如果它不產生任何輸出,你將不會相應地輸出。 (想想看,如果情況並非如此,那麼任何人都可以讀取數據庫密碼等,您可能已經將它們存儲在PHP文件中的變量中。) – CBroe