php - 我们需要关闭 file_get_contents 吗?

标签 php file-get-contents

我在一个循环中运行 file_get_contents(),我在 Apache 日志中看到打开了很多文件。我不知道背后的原因。我们是否需要在每次读取后关闭 file_get_contents() 函数?

最佳答案

file_get_contents() 读取文件并随后关闭文件。它返回读取数据或 false,因此无论如何您都没有文件句柄可用于 fclose()

关于php - 我们需要关闭 file_get_contents 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19650817/

相关文章:

php - json_decode file_get_contents 帮助

php - PHP 5.3 是否改变了 file_get_contents 的工作方式?

php file_get_contents($url) & 变成 &

php - 使用 file_get_contents 上传文件

php - 缩短 URL 以仅包含 get 请求?

PHP AES 256 加密怪异字符

javascript - 对于非 PHP 依赖项(如 jQuery、CSS 工具等),我应该使用还是避免使用 Composer?

php - 如果有图像,如何检查和显示图像

php - Zend Framework 1.10 中自定义函数的放置位置

php - cURL 返回空白