Problems with PHP input JSON data

Source: Internet
Author: User
I first use SQL to query out the data in the database, and then traverse it, and finally use Json_encode encoded output, the output is not JSON type, I ask you the great God, how to solve, extremely grateful!


Reply to discussion (solution)

That's JSON data, and you're not going to say JSON-type.

The result of your output is JSON type, but you look at the words is a bit of a problem, you go to Baidu online JSON format, put your data in the format of the line, but this data does not affect your query results, just JSON display problems.

The result looks really json, but I use AJAX parsing in JS to get the result as follows:
1, I write datatype in Ajax as JSON, what results can not get


2, I commented out the datatype, and then output data, resulting in a string



That's why I don't understand it here.


Where did this come from? Does it count as JSON?

Put in the < p=""> html

The result looks really json, but I use AJAX parsing in JS to get the result as follows:
1, I write datatype in Ajax as JSON, what results can not get


2, I commented out the datatype, and then output data, resulting in a string



That's why I don't understand it here.



This is because you have this page and HTML code, so you $phptest in Echo; Exit, add this exit; Stop the output, remember not to use PHP to output HTML code

Thank you, great God, the problem has been solved.

  • 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.