【问题标题】:property is not defined - a notice to be noticed属性未定义 - 需要注意的通知
【发布时间】:2012-08-17 10:28:03
【问题描述】:
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
)

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

【问题讨论】:

  • 谢谢 Si,你这样做真是太酷了。 ;-)

标签: php joomla joomla1.5 joomla2.5 joomla-extensions


【解决方案1】:

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

$params = $obj->params;
$params = json_decode($params);
echo $params->menu_image

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-04-17
    • 2016-11-12
    • 2011-03-05
    • 2015-02-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多