如何从保留 mysql 的本机类型列的 pdo-mysql 中获取数据?
示例:我从表中检索一些数据。此表包含 id 列,它是一个整数列。从该表中获取数据时,php 结果数组具有像字符串一样的 id 字段,而不是整数。
array(3) { ["id"]=> string(2) "11"
["name"]=> string(24) "test name"
["surname"]=> string(2) "test suname"
}
我知道使用 mysqlnd 驱动程序我可以在 php 中将其作为默认类型。
我使用 php 5.3 并且启用了 mysqlnd:
shell$ php -i | grep -i mysql
MySQL Support => enabled
Client API version => mysqlnd 5.0.8-dev - 20102224 - $Revision: 308673 $
mysql.allow_local_infile => On => On
mysql.allow_persistent => On => On
mysql.connect_timeout => 60 => 60
mysql.default_host => no value => no value
mysql.default_password => no value => no value
mysql.default_port => 3306 => 3306
mysql.default_socket => /var/mysql/mysql.sock => /var/mysql/mysql.sock
mysql.default_user => no value => no value
mysql.max_links => Unlimited => Unlimited
mysql.max_persistent => Unlimited => Unlimited
mysql.trace_mode => Off => Off
mysqli
MysqlI Support => enabled
Client API library version => mysqlnd 5.0.8-dev - 20102224 - $Revision: 308673 $
mysqli.allow_local_infile => On => On
mysqli.allow_persistent => On => On
mysqli.default_host => no value => no value
mysqli.default_port => 3306 => 3306
mysqli.default_pw => no value => no value
mysqli.default_socket => /var/mysql/mysql.sock => /var/mysql/mysql.sock
mysqli.default_user => no value => no value
mysqli.max_links => Unlimited => Unlimited
mysqli.max_persistent => Unlimited => Unlimited
mysqli.reconnect => Off => Off
mysqlnd
mysqlnd => enabled
Version => mysqlnd 5.0.8-dev - 20102224 - $Revision: 308673 $
PDO drivers => mysql, sqlite, sqlite2
pdo_mysql
PDO Driver for MySQL => enabled
Client API version => mysqlnd 5.0.8-dev - 20102224 - $Revision: 308673 $
pdo_mysql.default_socket => /var/mysql/mysql.sock => /var/mysql/mysql.sock
如何获取具有本机类型的数据?