What is the data format above? How can I avoid using PHP? Thanks

Source: Internet
Author: User
What is the following data format? What should I do with PHP? Thank you! I: 5; a: 10: {I: 2; a: 2: {s: 2: & quot; df & quot; s: 1: & quot; 0 & quot; s: 2: & quot; da & quot; s: 1: & quot; 1 & quot;} I: 22; a: 2: {s: 2: & quot; df & quot; what is the following data format? What should I do with PHP? Thank you!
I: 5; a: 10 :{
I: 2; a: 2: {s: 2: "df"; s: 1: "0"; s: 2: "da"; s: 1: "1 ";}
I: 22; a: 2: {s: 2: "df"; s: 1: "1"; s: 2: "da"; s: 1: "1 ";}
I: 18; a: 2: {s: 2: "df"; s: 1: "0"; s: 2: "da"; s: 1: "1 ";}
I: 130; a: 2: {s: 2: "df"; s: 1: "0"; s: 2: "da"; s: 1: "2 ";}
I: 4; a: 2: {s: 2: "df"; s: 1: "1"; s: 2: "da"; s: 1: "1 ";}
I: 128; a: 2: {s: 2: "df"; s: 1: "1"; s: 2: "da"; s: 1: "1 ";}
I: 20; a: 2: {s: 2: "df"; s: 1: "0"; s: 2: "da"; s: 1: "2 ";}
I: 1; a: 2: {s: 2: "df"; s: 1: "1"; s: 2: "da"; s: 1: "2 ";}
I: 3; a: 2: {s: 2: "df"; s: 1: "1"; s: 2: "da"; s: 1: "2 ";}
I: 129; a: 2: {s: 2: "df"; s: 1: "1"; s: 2: "da"; s: 1: "1 ";}
}

------ Solution --------------------
A lot: learning.
------ Solution --------------------
I: 5; and later parts are standard serialized strings, excluding line breaks, spaces, and other characters.

Unserialize (substr (......));
------ Solution --------------------
You have taken this out of context.
Remove the start I: 5, and delete the carriage return line break to serialize the string for php.

Print_r (unserialize ($ s ));
PHP code
Array ([2] => Array ([df] => 0 [da] => 1) [22] => Array ([df] => 1 [da] => 1) [18] => Array ([df] => 0 [da] => 1) [130] => Array ([df] => 0 [da] => 2) [4] => Array ([df] => 1 [da] => 1) [128] => Array ([df] => 1 [da] => 1) [20] => Array ([df] => 0 [da] => 2) [1] => Array ([df] => 1 [da] => 2) [3] => Array ([df] => 1 [da] => 2) [2, 129] => Array ([df] => 1 [da] => 1 ))
------ Solution --------------------
I learned how to serialize it several times.
------ Solution --------------------
I learned it too !!

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.