Codeigniter:$query->free_result() when using active record?

老子叫甜甜 提交于 2019-12-23 07:07:38

问题


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?


回答1:


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.

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:

https://www.codeigniter.com/user_guide/database/results.html



来源:https://stackoverflow.com/questions/775111/codeigniterquery-free-result-when-using-active-record

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!