当 mysqli_query
被执行时,PHP 从数据库(MySQL)接收结果集,我认为这是一个对象(mysqli_result 类)。
这个 mysqli_result 类是否在其属性中携带来自数据库的实际数据?
只是想知道结果在哪里......
最佳答案
Does this mysqli_result class carry actual data from database in its property?
没有。
它只包含一个指向内部结果集的链接,该链接无法直接访问,只能通过随后调用 mysqli_result::fetch_*
方法访问。
结果存在于Mysqli模块内部分配的内存中。它仍然在 PHP 端,但无法直接访问,it is occupying the memory available for PHP script (这是我关于 PDO 的文章,但它也适用于 mysqli)。
唯一的异常(exception)是 unbuffered query .对于这样的查询,PHP 端没有存储结果集,结果直接从数据库中获取。
关于php - mysqli_result 类实际获取的数据存在于何处?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41693720/