stdClass オブジェクト ( [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] => [ロボット] => [セキュア] => 0 )
これは、print_r を使用して json-decode した後の項目の出力です プロパティ menu-anchor_css にアクセスしたいのですが、このようなことはできません
$items=json_decode($item->params);
$class = $items->menu-anchor_css ? 'class="'.$items->anchor_css.'" ' : '';
$title = $items->menu-anchor_title ? 'title="'.$items->anchor_title.'" ' : '';
menu
定義されていないエラーメッセージが常に表示されるためです。(ここではハイフンとアンダーバーが問題のようです)
本当にありがとうございました