Php forms a json statement. how can I remove the preceding sentence!

Source: Internet
Author: User
Tags microsoft iis
Php forms a json statement. how can I remove the preceding sentence! Php source code
 $ Row ['usrtype '], 'sessionid' => $ usrname, 'usrnm' => $ row ['usrnm '], 'usrid' => $ row ['usrid']); echo json_encode ($ jsonArr); break;} else {echo '{"logintype ": "-1"} ';}}}}?>



The browser resolves
{"logintype":"0","sessionid":"0","usrnm":"mjc","usrid":"0"}



How can I remove the first line!


Reply to discussion (solution)

It is OK to convert the relevant program file to the utf8 file without bom.
The best way is to create a non-bom file, copy the code, and save it.

This sentence is not enough to be removed from the php page.

Before json output

Header ('content-type: application/json ');

Try ~

This sentence is not enough to be removed from the php page.



You can find a place to remove it. I don't have that output. it is estimated that it is the default one,

Include "./mobile/SQL. php ";

It is probably include "./mobile/SQL. php"; file generation. paste it and see it.

I have never encountered such a strange problem.

header("Content-type:application/json;charset=utf-8")

You must have added this sentence to the include page.

How can I remove it? this is also the case.
HTTP/1.1 200 OK
Date: Fri, 18 Apr 2014 09:00:59 GMT
Server: Microsoft-Microsoft IIS/6.0
X-Powered-By: ASP. NET
X-AspNet-Version: 4.0.30319
Content-Length: 2352
Cache-Control: private
Content-Type: application/json; charset = utf-8

{"Body": {"item": [{"BuyPriceoff": 0, "BuyTime": "unconfirmed", "CityId": 420100, "CityName ": "Wuhan", "Content": "Car pick up White years ago", "CountyId": 420105, "CountyName": "Hanyang", "CreateTime": "11:35:27 ", "DealerId": 11569, "HandleTime": "11:35:28", "Id": 23010786, "Name": "Zhang Guoxiong", "OrderType": 0, "Phone ": "18108624658", "ProvinceId": 420000, "ProvinceName": "Hubei", "ReDealerId": 11569, "SeriesId": 2945, "SeriesName": "Citroen C4L ", "SpecId": 15737, "SpecName": "Citroen C4L 2013 1.8L manual wisdom version", "State": 1 },{ "BuyPriceoff": 0, "BuyTime ": "", "CityId": 140100, "CityName": "Taiyuan", "Content": "", "CountyId": 140105, "CountyName": "", "CreateTime": "11:34:35", "DealerId": 6752, "HandleTime": "11:34:36", "Id": 23010726, "Name": "chestnut ", "OrderType": 1, "Phone": "15386885719", "ProvinceId": 140000, "ProvinceName": "Shanxi", "ReDealerId": 6752, "SeriesId": 792, "SeriesName": "Citroen C5", "SpecId": 17043, "SpecName": "Citroen C5 2013 2.0L auto-enjoy", "State": 1 }, {"BuyPriceoff": 0, "BuyTime": "", "CityId": 440300, "CityName": "Shenzhen", "Content": "", "CountyId ": 0, "CountyName": "", "CreateTime": "11:34:30", "DealerId": 75882, "HandleTime": "", "Id": 23010715, "Name": "Li", "OrderType": 0, "Phone": "18320819196", "ProvinceId": 440000, "ProvinceName": "Guangdong", "ReDealerId ": 0, "SeriesId": 2945, "SeriesName": "Citroen C4L", "SpecId": 17658, "SpecName ": "Citroen C4L 2014 model 1.8L automatic smart drive model Jinzhi", "State": 0 },{ "BuyPriceoff": 0, "BuyTime": "", "CityId ": 320300, "CityName": "Xuzhou", "Content": "", "CountyId": 0, "CountyName": "", "CreateTime": "11:34:04 ", "DealerId": 5248, "HandleTime": "", "Id": 23010688, "Name": "Wu", "OrderType": 0, "Phone ": "13852043028", "ProvinceId": 320000, "ProvinceName": "Jiangsu", "ReDealerId": 0, "SeriesId": 2945, "SeriesName": "Citroen C4L ", "SpecId": 15739, "SpecName": "Citroen C4L 2013 1.8L auto-tuning version", "State": 0 },{ "BuyPriceoff": 0, "BuyTime ": "", "CityId": 440300, "CityName": "Shenzhen", "Content": "Platinum Gray", "CountyId": 0, "CountyName ":"", "CreateTime": "11:33:39", "DealerId": 9802, "HandleTime": "11:33:40", "Id": 23010669, "Name": "Pan ", "OrderType": 0, "Phone": "13923846836", "ProvinceId": 440000, "ProvinceName": "Guangdong", "ReDealerId": 9802, "SeriesId": 2945, "SeriesName": "Citroen C4L", "SpecId": 14551, "SpecName": "Citroen C4L 2013 1.6L manual smart version", "State": 1}], "pages": 40337, "total": 201683}, "cache": 1000, "message": "", "success": 1, "result": 0} NULL

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.