php-mysql返回类型不对
PHP MySQL 查询返回的数据类型不对 全是 string
pubdate:2019-08-25 19:13:03
tags:php
每个 MySQL 操作查询返回的类型全是 string
一开始在网上找到说修改 pdo 下面这些选项,但我的项目已经是这样了
php
PDO::ATTR_STRINGIFY_FETCHES => false,
PDO::ATTR_EMULATE_PREPARES => false,
然后继续找,苦心人天不负 😂 找了大概两个小时发现一篇讲 PHP 数据库驱动的。然后就去检查 PHP 的数据库驱动
在网上找到了一个这样的脚本 http://www.q2zy.com/php-pdo 驱动-mysqlnd 折腾记
php
is installed ";
} else
$sentence.= "(Deprecated) MySQL is not installed ";
if (function_exists('mysqli_connect')) {
$hasMySQLi = true;
$sentence.= "and the new (improved) MySQL is installed. ";
} else
$sentence.= "and the new (improved) MySQL is not installed. ";
// 这句是关键,只有mysqlnd才提供了mysqli_fetch_all
if (function_exists('mysqli_fetch_all')) {
$withMySQLnd = true;
$sentence.= "This server is using MySQLnd as the driver.";
} else
$sentence.= "This server is using libmysqlclient as the driver.";
echo $sentence;
一检测果然是驱动太旧了,再翻回当初 php安装 这个文档。坑原来从一开始就挖下了
解决方案在上面的链接中