Array (
[330] => WP_Post Object (
[ID] => 330
[post_author] => 1
[post_date] => 2019-02-01 21:01:54
[post_date_gmt] => 2019-02-01 21:01:54
[post_content] =>
[post_title] => wordpress-4.9.8
[post_excerpt] =>
[post_status] => inherit
[comment_status] => open
[ping_status] => closed
[post_password] =>
[post_name] => wordpress-4-9-8
[to_ping] =>
[pinged] =>
[post_modified] => 2019-02-01 21:01:54
[post_modified_gmt] => 2019-02-01 21:01:54
[post_content_filtered] =>
[post_parent] => 329
[guid] => http://localhost:8080/brainwise/wp-content/uploads2019/02/wordpress-4.9.8.zip
[menu_order] => 0
[post_type] => attachment
[post_mime_type] => application/zip
[comment_count] => 0
[filter] => raw
)
)
我正在使用WordPress,并且我的帖子表中包含以下对象数组,我想提取该数组的guid
元素。
我如何提取呢?
答案 0 :(得分:1)
只需使用get_the_guid( $post->ID );
。
请参阅:https://developer.wordpress.org/reference/functions/get_the_guid/
答案 1 :(得分:0)
获取密钥,然后获取其中的对象
<p>echo $array_name[array_keys($array_name)[0]]->{guid};</p>