For the two pages compiled by EclipsePHPStudiov1.2.2 in the same editor, why is the print_r output different font size formats? Use ajax. php normally, use osg_aja

Source: Internet
Author: User
For the two pages written by EclipsePHPStudiov1.2.2 in the same editor, why are the output of print_r in different font size formats? It is normal to use ajax. php, and use osg_aja to write the two pages written in EclipsePHPStudiov1.2.2 in the same editor. why is the print_r output of different font sizes in different formats? As a result, two pages written by EclipsePHP Studio v1.2.2 in the same editor of three provinces and cities are displayed. why is the output of print_r in different font size formats? Use ajax. php normally, use osg_aja
For the two pages written by EclipsePHP Studio v1.2.2 in the same editor, why are the output formats of print_r fonts inconsistent? As a result, ajax. php is normally used for interaction between three provinces and cities, and osg_ajax.php is abnormal.
The code in ajax. php is as follows:
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 ));

The output result is as follows:
-------------------------------------------------------

-------------------------------------------------------



Osg_ajax.php
The code is as follows:
$ 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 ));

--------------------------------------------------
The output result is as follows:


------ Solution --------------------
Encoding problems? BOM header?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.