我需要一种在 PHP 中非常简单地将文件存储在内存中的方法,该文件正在构建,然后立即发送到另一个 Web 服务。我看到从 PHP 5.1 开始,php://temp
和 php://memory
流可用,但似乎没有太大区别两者之间:php://temp
支持stream_select()
函数而php://memory
不支持。在这种情况下我应该使用哪一个,或者是否有更好的方法在 PHP 中执行内存映射文件?
最佳答案
直接来自 the relevant manual page :
The php://memory wrapper stores the data in the memory. php://temp behaves similarly, but uses a temporary file for storing the data when a certain memory limit is reached (the default is 2 MB).
来源: 我在 Google 上搜索了 php temp memory
。这是第一个结果,答案在摘录中。
php://temp
听起来很适合您的用例。
关于php - PHP中的内存映射文件,php ://temp and php://memory有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6005342/