0
stdClass Object (
[id] => 105
[menutype] => englishmenu
[title] => Product Verification
[alias] => product-verification
[note] =>
[path] => software-outsourcing/product-verification
[link] => index.php?option=com_content&view=article&id=2
[type] => component
[published] => 1
[parent_id] => 103
[level] => 2
[component_id] => 22
[ordering] => 0
[checked_out] => 0
[checked_out_time] => 0000-00-00 00:00:00
[browserNav] => 0
[access] => 1
[img] =>
[template_style_id] => 0
[params] => {\"show_title\":\"\",\"link_titles\":\"\",\"show_intro\":\"\",\"show_category\":\"\",\"link_category\":\"\",\"show_parent_category\":\"\",\"link_parent_category\":\"\",\"show_author\":\"\",\"link_author\":\"\",\"show_create_date\":\"\",\"show_modify_date\":\"\",\"show_publish_date\":\"\",\"show_item_navigation\":\"\",\"show_vote\":\"\",\"show_icons\":\"\",\"show_print_icon\":\"\",\"show_email_icon\":\"\",\"show_hits\":\"\",\"show_noauth\":\"\",\"urls_position\":\"\",\"menu-anchor_title\":\"\",\"menu-anchor_css\":\"\",\"menu_image\":\"\",\"menu_text\":1,\"page_title\":\"\",\"show_page_heading\":0,\"page_heading\":\"\",\"pageclass_sfx\":\"\",\"menu-meta_description\":\"\",\"menu-meta_keywords\":\"\",\"robots\":\"\",\"secure\":0}
[lft] => 50
[rgt] => 51
[home] => 0
[language] => en-GB
[client_id] => 0
)

那就是$item我 print_r 的变量内容,我正在使用 Joomla。显然有一个名为“menu_image”的属性,但是当我运行我的应用程序时,我总是会遇到未定义 stdclass::menu_image 属性的通知,我真的很困惑,只能从这个真正的魔术师网站寻求帮助。任何帮助将不胜感激,我非常感谢大家。

4

1 回答 1

0

不,它不作为该对象的直接属性存在,而是一个 json 编码的字符串:

$params = $obj->params;
$params = json_decode($params);
echo $params->menu_image
于 2012-08-17T10:32:52.373 回答