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
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);