您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php实现执行非缓冲查询API的三种方法

2025/11/17 20:19:17发布16次查看
这篇文章主要为大家介绍了三种php执行非缓冲查询api,非缓冲查询适应于大数据量查询,php如何执行非缓冲查询,感兴趣的小伙伴们可以参考一下
对于php的缓冲模式查询大家都知道,下面列举的例子是如何执行非缓冲查询api。
非缓冲查询方法一: mysqli
<?php $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); $uresult = $mysqli->query("select name from city", mysqli_use_result); if ($uresult) { while ($row = $uresult->fetch_assoc()) { echo $row['name'] . php_eol; } } $uresult->close(); ?>
非缓冲查询方法二: pdo_mysql
<?php $pdo = new pdo("mysql:host=localhost;dbname=world", 'my_user', 'my_pass'); $pdo->setattribute(pdo::mysql_attr_use_buffered_query, false); $uresult = $pdo->query("select name from city"); if ($uresult) { while ($row = $uresult->fetch(pdo::fetch_assoc)) { echo $row['name'] . php_eol; } } ?>
非缓冲查询方法三: mysql
<?php $conn = mysql_connect("localhost", "my_user", "my_pass"); $db = mysql_select_db("world"); $uresult = mysql_unbuffered_query("select name from city"); if ($uresult) { while ($row = mysql_fetch_assoc($uresult)) { echo $row['name'] . php_eol; } } ?>
总结:以上就是本篇文的全部内容,希望能对大家的学习有所帮助。
相关推荐:
php二维数组去重算法图文详解
php获取post数据的三种方法详解
thinkphp中去除url里的index.php
以上就是php实现执行非缓冲查询api的三种方法的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product