how to parse wordpress post_meta table values

前端 未结 3 1664
遥遥无期
遥遥无期 2021-02-01 23:41

I have to parse wordpress post_meta table , particularly \"_wp_attachment_metadata\" field

For example:

Its value is for a po

相关标签:
3条回答
  • 2021-02-02 00:16

    Thanks a lot for Craig quick answer.

    Used the unserialize method and got everything from the string.

    Array
    (
        [width] => 523
        [height] => 523
        [hwstring_small] => height='96' width='96'
        [file] => 2010/11/tee1.jpg
        [sizes] => Array
            (
                [thumbnail] => Array
                    (
                        [file] => tee1-150x150.jpg
                        [width] => 150
                        [height] => 150
                    )
    
                [medium] => Array
                    (
                        [file] => tee1-300x300.jpg
                        [width] => 300
                        [height] => 300
                    )
    
                [post-thumbnail] => Array
                    (
                        [file] => tee1-523x198.jpg
                        [width] => 523
                        [height] => 198
                    )
    
            )
    
        [image_meta] => Array
            (
                [aperture] => 0
                [credit] => 
                [camera] => 
                [caption] => 
                [created_timestamp] => 0
                [copyright] => 
                [focal_length] => 0
                [iso] => 0
                [shutter_speed] => 0
                [title] => 
            )
    
    )
    

    Here is the output, now can take any image from the wordpress post meta_data

    0 讨论(0)
  • 2021-02-02 00:18

    What I understand is:

    There are two types of variables, for example:

    1. a:6:
    2. s:3:

    a = array and 6 is the dimension of the array
    s = string and 3 is the length of the string

    0 讨论(0)
  • 2021-02-02 00:29

    Try:

    $a = unserialize("");
    print_r($a);
    

    http://php.net/manual/en/function.unserialize.php

    0 讨论(0)
提交回复
热议问题