mysqli - Do I really need to do $result->close(); & $mysqli->close();?

后端 未结 4 469
逝去的感伤
逝去的感伤 2020-12-13 06:44

Just started using mysqli. If I\'m working with small data sets on small websites (traffic-wise), do I really need to use these all the time?

$result->clo         


        
4条回答
  •  -上瘾入骨i
    2020-12-13 06:49

    I felt an update to this thread was needed...

    According to current documentation, you should always use $mysql->kill() in addition to $mysql->close().

    $thread = $mysqli->thread_id;
    $mysqli->kill($thread);
    $mysqli->close();
    

    (As a side note, I asked Oracle developers about using PDO with MySQL and they discouraged it. They use MySQLi exclusively. PDO hasn't been maintained and it doesn't support many of MySQL's current features.) Edit: obsolete comment.

    Edit: switched the statement order, as suggested.

提交回复
热议问题