简体   繁体   中英

PHP, PDO. How do I get the default fetch mode?

It is possible to set the default fetch mode using:

$dbh->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, $fetch_mode);

Consider such a function:

<?php

function do_something($fetch_mode = /* default fetch mode */){
  // Do something
}

?>

Here I need to GET the default fetch mode. How do I get it?

echo $dbh->getAttribute(PDO::ATTR_DEFAULT_FETCH_MODE);

这为您提供了一个 int,您可以使用手册中提供的列表自己进行映射。

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