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

WBOY
WBOYOriginal
2016-06-13 10:33:05738browse

同一个编辑器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头?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn