Home > Backend Development > PHP Tutorial > 请教上面的是什么数据格式?用PHP如何避免?多谢

请教上面的是什么数据格式?用PHP如何避免?多谢

WBOY
Release: 2016-06-13 13:17:10
Original
791 people have browsed it

请问下面的是什么数据格式?用PHP如何处理?谢谢!
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";}
}

------解决方案--------------------
好多:,学习了。
------解决方案--------------------
i:5; 及后面部分,都是标准的序列化后的字符串,不包括换行,空格等字符,拼接在一起就不是了

unserialize(substr(……));
------解决方案--------------------
你这个是断章取义了
去掉 开始的 i:5; 并删除回车换行符后,为 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
        )

    [129] => Array
        (
            [df] => 1
            [da] => 1
        )

)
<br><font color="#e78608">------解决方案--------------------</font><br>学习了,没序列化过几次。
<br><font color="#e78608">------解决方案--------------------</font><br>我也学习了!! <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template