file_get_contents.php : file_get_contents « File Directory « PHP






file_get_contents.php

 
<?php
   $userfile= file_get_contents("data.txt");
   $users = explode("\n",$userfile);
   foreach ($users as $user) {
      list($name, $email) = explode(" ", $user);
      echo "<a href=\"mailto:$email\">$name/a> <br />";
   }
?>
  
  








Related examples in the same category

1.Check net speed by loading a file
2.Checking for an error from file_get_contents()
3.Fetching a URL with file_get_contents()
4.Reading a file into a string
5.file_put_contents( ) writes to a file with the equivalent of fopen( ), fwrite( ), and fclose( ) all in one function, just like file_get_contents( ).
6.Use file_get_contents with a URL
7.Retrieving a protected page
8.Retrieving a remote page with file_get_contents()