如何获取使用 tmpfile() 创建的文件的路径


How to get the path of a file create with tmpfile()

我只是用tmpfile创建一个临时文件,以便将我从远程FTP服务器获得的文件放入其中。

我需要将该文件的 URL 传递给 API,但tmpfile返回资源...如何检索其路径?

实际上, stream_get_meta_data($file)['uri']应包含路径。