Unserializing data doesn't work

前端 未结 3 1240
迷失自我
迷失自我 2021-01-21 13:35

Been at this for the past 5 hours and I\'m stumped. Tried the most ridiculous functions to try and fix it but to no avail.

I\'m retrieving data from a WP database. The

3条回答
  •  青春惊慌失措
    2021-01-21 14:02

    Whoops found the answer! :) WP function hidden in functions.php from WP themselves.

    function maybe_unserialize( $original ) {
        if ( is_serialized( $original ) ) // don't attempt to unserialize data that wasn't serialized going in
            return @unserialize( $original );
        return $original;
    }
    

    Fixed the unserializing by doing:

    $unserialized = maybe_unserialize( unserialize( $usermeta['facebookmeta'] ));
    

    Returns it all in a neat array! :)

    Happy happy! :)

提交回复
热议问题