1
我试图从MS-SQL查询中获取具有utf-8值的数组。PHP阵列重复:每个字符串键都有数字键
几乎一切工作正常,但结果数组是这样的:
Array (
[id] => 1;
[0] => 1; // this is redundant
[countryName] => england;
[1] => england; // this is redundant
)
我不想重复的数字键。为什么他们甚至被创造?导致此结果的代码是:
# execute the query
foreach ($pdoConnection->query($sqlStatement) as $row) {
// encode row in utf8 so json works and save row in array
$output[] = array_map('utf8_encode', $row);
}
感谢您的任何想法如何解决。
尝试'var_dump'行,看看它里面有什么 – mehulmpt