从数据库中取出的数据,字段名为gb2312的 数据转码为utf8
$pj = Pj::find()->where($map)->asArray()->one(); if(!empty($pj)) { foreach ($pj as $k=>$v) { $f = iconv('GBK', 'UTF-8', $k); $result['pj'][$f] = $v; } } $mfjctl = Mfjctl::find()->where($map)->asArray()->one(); if(!empty($mfjctl)) { foreach ($mfjctl as $k=>$v) { $f = iconv('GBK', 'UTF-8', $k); $result['mfjctl'][$f] = $v; } }