how to read from temp files php

Solutions on MaxInterview for how to read from temp files php by the best coders in the world

showing results for - "how to read from temp files php"
Alejandra
30 Oct 2016
1
2To get the underlying file path of a tmpfile file pointer:
3
4<?php
5$file = tmpfile();
6$path = stream_get_meta_data($file)['uri']; // eg: /tmp/phpFx0513a
7
8
Ivan
03 Jun 2018
1<?php$dir = sys_get_temp_dir();$tmp = tempnam($dir, "foo");file_put_contents($tmp, "hello");$f = fopen($tmp, "a");fwrite($f, " world");fclose($f);echo file_get_contents($tmp);