function display_sourcecode($url) { $lines = file($url); $output = ""; foreach ($lines as $line_num => $line) { // loop thru each line and prepend line numbers $output.= "Line #{$line_num} : " . htmlspecialchars($line) . "n"; } } 复制代码 用法: $url = "http://www.open-open.com";$source = display_sourcecode($url);echo $source;?> 复制代码 웹, HTML, PHP