PHP/MYSQLI:fetch_assoc()与fetch_array(MYSQLI_ASSOC) [英] PHP/MYSQLI: fetch_assoc() vs fetch_array(MYSQLI_ASSOC)
问题描述
$result->fetch_assoc()
和
之间是否存在任何种类的差异
$result->fetch_array(MYSQLI_ASSOC)
还是完全相同的东西?
Is there any difference of any kind between $result->fetch_assoc()
and
$result->fetch_array(MYSQLI_ASSOC)
or they are exactly the same thing?
在提出此问题之前,我已经进行了一些搜索,但是我发现的唯一内容(此处)是没有参数的$result->fetch_array()
允许数字索引和关联索引,而
$result->fetch_assoc()
仅允许关联索引,因此最后一个具有更好的性能.
I have searched a bit before making this question but the only thing I've found (here) is that $result->fetch_array()
with no params allows numeric and associative indexes while
$result->fetch_assoc()
only allows the associative indexes and therefore the last one has a better performance.
推荐答案
是的,目的格式和返回的格式.
Yes, purpose and returned formats.
fetch_array()
具有更多的输出格式.您可以在此处 PHP手册:mysqli_result :: fetch_array .
fetch_array()
has more output formats. You can see here PHP Manual : mysqli_result::fetch_array.
PHP手册:mysqli_result :: fetch_assoc()输出单一格式.
这篇关于PHP/MYSQLI:fetch_assoc()与fetch_array(MYSQLI_ASSOC)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!