The Json_encode output value is not the same in laravel-php.

Source: Internet
Author: User
The array printed with Print_r is this:

Array(    [total] => 8    [rows] => Array        (            [0] => Array                (                    [id] => 1                    [email] => 379395979@qq.com                    [activated] => 1                    [username] => yuan                    [created_at] => 2014-03-04 02:30:43

Why use Json_encode output after the other data are good, only activated this field will turn 1 into a true,0 to false, has anyone encountered this situation? How to resolve to output the original value ...
Frame is Laravel4

JSON values like this:

{"total":8,"rows":[{"id":1,"email":"379395979@qq.com","activated":true,"activated_at":null,"last_login":"2014-04-03 05:41:30","username":"yuan","created_at":"2014-03-04 02:30:43"}

Reply content:

The array printed with Print_r is this:

Array(    [total] => 8    [rows] => Array        (            [0] => Array                (                    [id] => 1                    [email] => 379395979@qq.com                    [activated] => 1                    [username] => yuan                    [created_at] => 2014-03-04 02:30:43

Why use Json_encode output after the other data are good, only activated this field will turn 1 into a true,0 to false, has anyone encountered this situation? How to resolve to output the original value ...
Frame is Laravel4

JSON values like this:

{"total":8,"rows":[{"id":1,"email":"379395979@qq.com","activated":true,"activated_at":null,"last_login":"2014-04-03 05:41:30","username":"yuan","created_at":"2014-03-04 02:30:43"}

Using var_dump to see the type of data source, LZ printing results are different, the problem is in the data source, if the data table is not a problem, it should be from the database to obtain data from the data format is problematic.

json_encodeNo change bool in value
..
I just got the wrong idea.
Tested a bit, did not find json_encode a change ...
Laravel Source also did not find the conversion of the place.

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