Home > Article > Backend Development > 同一个编辑器EclipsePHP Studio v1.2.2编纂的两个页面,print_r输出为何字体大小格式不一致? 用ajax.php正常,用osg_aja
同一个编辑器EclipsePHP Studio v1.2.2编写的两个页面,print_r输出为何字体大小格式不一致? 用ajax.php正常,用osg_aja
同一个编辑器EclipsePHP Studio v1.2.2编写的两个页面,print_r输出为何字体大小格式不一致?结果导致三级省市联动用ajax.php正常,用osg_ajax.php不正常
ajax.php中代码如下:
header("Content-Type:text/html;charset=gbk");
$sql = "SELECT * FROM `ecs_region` WHERE `parent_id` = '1' ORDER BY `region_id` ASC ";
$list = $db->getAll($sql);
foreach ($list as $key => $val ) {
$list[$key]['region_name'] = urlencode (iconv ('gbk','utf-8',$val['region_name']));
}
print_r (json_encode ($list));
输出结果如下:
———————————————————————————————————————————————————————
———————————————————————————————————————————————————————
osg_ajax.php
代码如下:
$sql = "SELECT * FROM `osg_region` WHERE `parent_id` = '1' ORDER BY `region_id` ASC ";
$cursor = exequery( $connection, $sql);
while($rows=mysql_fetch_assoc( $cursor )){
$arr[]=$rows;
}
foreach ($arr as $key => $val )
{
$arr[$key]['region_name'] = urlencode (iconv ('gbk','utf-8',$val['region_name'])); //
}
print_r (json_encode ($arr));
——————————————————————————————————————————————————
输出结果如下:
------解决方案--------------------
编码问题? BOM头?