什么更快? file_put_contents(); fopen()函数;的fwrite(); FCLOSE();? [英] What's faster? file_put_contents(); fopen(); fwrite(); fclose();?

查看:182
本文介绍了什么更快? file_put_contents(); fopen()函数;的fwrite(); FCLOSE();?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么更好?我有我自己的MySQL日志,所以它有大约90MB,但我不知道我应该使用哪一个。它打开文件EVERYTIME有查询执行。 http://web.archive.org/web/20100109103851/http://balancedbraces.com/2008/06/12/fopen-fwrite-fclose-vs-file_put_contents/rel =noreferrer>本文, fwrite()是一个更快的smidgen。



我的猜测是 file_put_contents() code>只是这三种方法的一个包装,所以你会失去开销。
$ b

编辑本网站有相同的信息。


What is better? I have my own MySQL log so it has about 90MB, but I'm not sure which one should I use. It opens file EVERYTIME there is query to execute.

What's faster?

解决方案

According to this article, the fwrite() is a smidgen faster. (Link to Wayback Machine, because site no longer exists.)

My guess is that file_put_contents() is just a wrapper around those three methods anyways, so you would lose the overhead.

EDIT : This site has the same information.

这篇关于什么更快? file_put_contents(); fopen()函数;的fwrite(); FCLOSE();?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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