使用PDO ASSOC语句时,我只获得列的第一个字母而不是完整的一个字母。有任何想法吗 ?更多信息如下:
通过PHP获取fetch_assoc的小代码块:
$pdo = new PDO("xxx", "user","pwd");
$pdo->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_TO_STRING);
$query = $pdo->query("SELECT TRND.TRANID FROM PCRMTRND AS TRND");
$query->execute();
$tmp = array();
while($row=$query->fetch(PDO::FETCH_ASSOC)) {
array_push($tmp,$row);
}
填充数组tmp后:
每行Var DUMP:
ODBC的设置:
[xxx]
Description = iSeries ODBC
Driver = IBM i Access ODBC Driver
System = /
UserID =
Password =
Naming = 0
DefaultLibraries = QGPL
Database =
ConnectionType = 0
CommitMode = 2
ExtendedDynamic = 1
DefaultPkgLibrary = QGPL
DefaultPackage = A/DEFAULT(IBM),2,0,1,0,512
AllowDataCompression = 1
LibraryView = 0
AllowUnsupportedChar = 0
ForceTranslation = 0
Trace = 0
答案 0 :(得分:1)
我遇到了同样的问题,它似乎与区域设置有关。当我从" en_US.UTF-8"更改LC_ALL时到" en_US.ISO-8859-1"问题消失了。因此,我没有UTF的输出:(