Posted By

onefastsnail on 05/24/12


Tagged


Versions (?)

echo file contents


 / Published in: Other
 

  1. <p>Code:</p>
  2.  
  3. <?php
  4. // Get the HTML source of a URL.
  5. $lines = file ('test.php');
  6.  
  7. // Loop through our array, show html source as html source; and line numbers too.
  8. foreach ($lines as $line_num => $line) {
  9. echo "Line <b>{$line_num}</b> : " . htmlspecialchars($line) . "<br>\n";
  10. }
  11. ?>

Report this snippet  

You need to login to post a comment.