Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 29th, 2012  |  syntax: None  |  size: 0.87 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. PHP: readfile() has been disabled for security reasons
  2. var_dump(ini_get('disable_functions'));
  3.        
  4. $file = fopen($filename, 'rb');
  5. if ( $file !== false ) {
  6.     while ( !feof($file) ) {
  7.         echo fread($file, 4096);
  8.     }
  9.     fclose($file);
  10. }
  11.        
  12. $file = fopen($filename, 'rb');
  13. if ( $file !== false ) {
  14.     fpassthru($file);
  15.     fclose($file);
  16. }
  17.        
  18. $data = file($filename);
  19. if ( $data !== false ) {
  20.     echo implode('', $data);
  21. }
  22.        
  23. $file = fopen($yourFileNameHere, 'rb');
  24. if ( $file !== false ) {
  25.     while ( !feof($file) ) {
  26.         echo fread($file, 4096);
  27.     }
  28.     fclose($file);
  29. }
  30.  
  31. //OR
  32. $contents = file_get_contents($yourFileNameHere); //if for smaller files
  33.        
  34. $path = '/some/path/to/file.html';
  35. $file_string = '';
  36. $file_content = file($path);
  37. // here is the loop
  38. foreach ($file_content as $row) {
  39.      $file_string .= $row;
  40. }
  41.  
  42. // finally print it
  43. echo $file_string;