What kind of data format is that?

后端 未结 2 697
北海茫月
北海茫月 2020-12-20 16:57

I found this record in the database which is used to hold multiple values. I want to know what is this format called so that I know how to deal with it?

a:4:         


        
相关标签:
2条回答
  • 2020-12-20 17:30

    You can use unserialize($sVarwiththeSerializedData) to revert it to the original state .

    0 讨论(0)
  • 2020-12-20 17:38

    It is a PHP serialized object, i.e. an object serialized with serialize() function: http://php.net/manual/en/function.serialize.php

    For instance (from the manual):

    class A {
        public $one = 1;
    
        public function show_one() {
            echo $this->one;
        }
    }
    
    $a = new A;
    $s = serialize($a);
    file_put_contents('store', $s);
    

    Gives:

    O:1:"A":1:{s:3:"one";i:1;}
    
    0 讨论(0)
提交回复
热议问题