使用PHP可以通过以下方法显示文件内容:
使用file_get_contents()函数读取文件内容并输出:$file = 'example.txt';$content = file_get_contents($file);echo $content;使用fopen()函数打开文件,并通过fgets()函数逐行读取文件内容并输出:$file = 'example.txt';$handle = fopen($file, 'r');while (!feof($handle)) { $line = fgets($handle); echo $line;}fclose($handle);使用readfile()函数直接输出文件内容:$file = 'example.txt';readfile($file); 

