我正在使用WordPress插件,它有一個變量,名爲$ item,它包含一些文章的一些數據。PHP提取值形成一個變量
我用var_dump函數來顯示它的數據,
var_dump($item);
但我沒能獲得一個項目的價值。
我只需要得到ITEM_ID和item_order
有人可以幫助我得到這個值,並分配給另一個變量。 謝謝
這裏是轉儲
object(LP_Lesson)#11313 (5) {
["id"]=> int(6915)
["post"]=> object(WP_Post)#11357 (29) {
["ID"]=> int(6915) ["post_author"]=> string(1) "1"
["post_date"]=> string(19) "2015-06-05 04:29:56" ["post_date_gmt"]=> string(19) "2015-06-05 04:29:56" ["post_content"]=> string(5971) "" ["post_title"]=> string(20) "Add and manage users" ["post_excerpt"]=> string(1) " " ["post_status"]=> string(7) "publish"
["post_parent"]=> int(0) ["guid"]=> string(66) "test" ["menu_order"]=> int(0) ["post_type"]=> string(9) "lp_lesson" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" ["section_item_id"]=> string(1) "3"
["section_id"]=> string(1) "1"
["item_id"]=> string(4) "6915"
["item_order"]=> string(1) "3"
["item_type"]=> string(9) "lp_lesson" }
["content"]=> string(0) "" ["lesson_type"]=> NULL ["_item":protected]=> object(WP_Post)#11357 (29) { ["ID"]=> int(6915) ["post_author"]=> string(1) "1" ["post_date"]=> string(19) "2015-06-05 04:29:56" ["post_date_gmt"]=> string(19) "2015-06-05 04:29:56" ["post_content"]=> string(5971) "
你嘗試過什麼到目前爲止,訪問你需要 – Regolith
自PHP對象不是它只是'$用品 - > ITEM_ID數據'? – Deckerz
你試過'$ item-> id'&'$ item-> post-> item_order'嗎? – AliAwwad