简体   繁体   中英

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

在我从CodeIgniter模型中的活动记录查询完成结果集后,我应该使用$query->free_result()还是ActiveRecord会自动执行此操作?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM