Retrieve path of tmpfile()

后端 未结 2 1413
攒了一身酷
攒了一身酷 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:14

    It seems stream_get_meta_data() also works :

    $tmpHandle = tmpfile();
    $metaDatas = stream_get_meta_data($tmpHandle);
    $tmpFilename = $metaDatas['uri'];
    fclose($tmpHandle);
    

提交回复
热议问题