Dynamically force partial php download

0

In a code as an example below, you can only download the contents of the $ arr variable, without having to write the contents in any folder.

<!doctype html>
<html>
<head>
<meta charset="iso-8859-2">
<title>Untitled Document</title>
</head>

<body>

<? //Generate text file on the fly

   header("Content-type: text/plain");
   header("Content-Disposition: attachment; filename=savethis.txt");

   for($i=0;$i<100;$i++){
       $arr[] = "teste ".$i;
   }

   print "Texto de teste...\n";
   print_r($arr);

 ?>

</body>
</html>

Thank you Marco

    
asked by anonymous 11.05.2018 / 20:18

0 answers