Quick PHP file_get_contents/readfile query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



What is the difference between readfile and file_get_contents+echo?

Why does my code work when I use readfile but not when I use file_get_contents 
followed by echo?

By work I mean M$ Excel opens and reads the spreadsheet properly. When it 
fails, Excel shows an empty spreadsheet which to me says the XML has been 
corrupted.

<? # vim: ft=php ai et tw=0
header('content-type: text/xml');
header("Content-Disposition: attachment; filename=\"adoptions.xls\"");
$file=file_get_contents('/home/httpd/uploads/ADOPTIONS.xml');
echo $file;

#readfile('/home/httpd/uploads/ADOPTIONS.xml');
exit;
?>

-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000     


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux