我们需要关闭file_get_contents吗? [英] Do we need to close file_get_contents?

查看:292
本文介绍了我们需要关闭file_get_contents吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm running file_get_contents() inside a loop, I see a lot of files opened in the Apache log. I don't know the reason behind it. Do we need to close the file_get_contents() function after each read?

推荐答案

file_get_contents()读取文件,然后关闭文件.它返回读取的数据或false,因此无论如何您都没有文件句柄可与fclose()一起使用.

file_get_contents() reads a file and closes the file afterwards. It returns the read data or false, so you have no file handle to use with an fclose(), anyway.

这篇关于我们需要关闭file_get_contents吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆