代码:$ query-> free_result()使用活动记录时? [英] Codeigniter:$query->free_result() when using active record?

查看:286
本文介绍了代码:$ query-> free_result()使用活动记录时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我完成了我的结果集从一个活动记录查询在一个codeigniter模型,我应该使用$ query-> free_result()或者自动执行activerecord?

after i have finished with my result set from a active record query in a codeigniter model, should i use $query->free_result() or does activerecord automatically do that?

推荐答案

PHP会在脚本完成后清除所有内容。但是,如果你在一个循环中有很多查询,结果将不会在每次迭代后清除。

PHP will clean up everything after your script is done. However, if you have lots of queries in, say, a loop, the results will not be cleaned up after each iteration.

因此,如果你运行大量查询一个循环,你可能想要free_result()来清除内存。否则,没有必要。详情请参阅这里:

So, if you run lots of queries in a loop, you probably will want to free_result() to clear up memory. Otherwise, it's not necessary. See here for details:

http://ellislab.com/codeigniter/user-guide/database/results.html

这篇关于代码:$ query-> free_result()使用活动记录时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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