PHP:如何在頁面上顯示文字檔案的內容?
file_get_contents 函式以 php 檔案的名稱作為引數,讀取文字檔案的內容並在控制檯上顯示。獲取內容並將其 echo 出來。
<?php echo file_get_contents( "filename.php" ); ?>
filename.php 的內容將作為輸出。
在上文中,透過傳遞 php 檔名來呼叫函式“file_get_contents”。輸出將是 php 檔案中存在的內容。
廣告
file_get_contents 函式以 php 檔案的名稱作為引數,讀取文字檔案的內容並在控制檯上顯示。獲取內容並將其 echo 出來。
<?php echo file_get_contents( "filename.php" ); ?>
filename.php 的內容將作為輸出。
在上文中,透過傳遞 php 檔名來呼叫函式“file_get_contents”。輸出將是 php 檔案中存在的內容。