Retrieve path of tmpfile()

后端 未结 2 1411
攒了一身酷
攒了一身酷 2020-12-24 04:50

Quickie...

Is there a way to retrieve the path of a file created by tmpfile()?

Or do I need to do it myself with tempnam()?

2条回答
  •  自闭症患者
    2020-12-24 05:28

    Like this

    $path = array_search('uri', @array_flip(stream_get_meta_data($GLOBALS[mt_rand()]=tmpfile()))); 
    file_put_contents($path, 'hello'); 
    

提交回复
热议问题