首页 > 解决方案 > 我想将 id 值存储在变量 ex $id=76 中

问题描述

Array
(
    [0] => stdClass Object
        (
            [id] => 76
            [header_left] => http://localhost/kaladisha/uploads/Lighthouse9.jpg
            [header_right] => http://localhost/kaladisha/uploads/Jellyfish3.jpg
            [content_topic] => 
            [content_subtopic] => 
            [content] => 
            [footer_img1] => 
            [footer_img2] => 
            [footer_img3] => 
            [footer_img4] => 
        )

)

我想将id值存储在变量中,例如:

$id = 76

标签: arraysassociative

解决方案


鉴于您的数组变量名称是$array

$id = $array[0]->id

推荐阅读