的输出php -i | grep mysqlnd
是:
Client API version => mysqlnd 5.0.11-dev - 20120503 - $Id: 40933630edef551dfaca71298a83fad8d03d62d4 Client API library version => mysqlnd 5.0.11-dev - 20120503 - $Id: 40933630edef551dfaca71298a83fad8d03d62d4 mysqlnd mysqlnd => enabled Version => mysqlnd 5.0.11- dev - 20120503 - Id: 40933630edef551dfaca71298a83fad8d03d62d Loaded plugins => mysqlnd,debug_trace,auth_plugin_mysql_native_password,auth_plugin_mysql_clear_password mysqlnd statistics => Client API version => mysqlnd 5.0.11-dev - 20120503 - $Id: 40933630edef551dfaca71298a83fad8d03d62d4
这表明它已加载,mysqlnd => enabled
但所有数据库值仍以字符串形式出现,未转换为原生 PHP 类型:
$connection = new mysqli('127.0.0.1', 'root', '', 'my_database');
// Settings contains one tinyint field 'enabled'
$result = mysqli_query($connection, 'select * from settings');
var_dump(mysqli_fetch_array($result));
结果
array (size=1)
'enabled' => string '1' (length=1)
预期的
array (size=1)
'enabled' => int 1
我是否缺少一些配置/任何建议?