sytchenko

PHP Generate text file to download on the fly

Jul 28th, 2019 (edited)
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.26 KB | None | 0 0
  1. <? //Generate text file on the fly
  2.  
  3.    header("Content-type: text/plain");
  4.    header("Content-Disposition: attachment; filename=savethis.txt");
  5.  
  6.    // do your Db stuff here to get the content into $content
  7.    print "This is some text...\n";
  8.    print $content;
  9. /?>
Add Comment
Please, Sign In to add comment