0

drupal からこのような配列出力があります。field_episode_tags から [name] の値にアクセスするにはどうすればよいですか。

print $node->field_episode_tags['und']['0']['taxonomy_term']->['name']

「分類用語」に到達すると、別のオブジェクトを使用して試した別のオブジェクトがあります-> poitnerが機能しませんでした。

stdClass Object
    (
        [vid] => 25
        [uid] => 1
        [title] => Is there any cosmos theory?
        [log] => 
        [status] => 1
        [comment] => 1
        [promote] => 0
        [sticky] => 0
        [nid] => 25
        [type] => tv_episode
        [language] => en
        [created] => 1380610491
        [changed] => 1381115053
        [tnid] => 0
        [translate] => 0
        [revision_timestamp] => 1381115053
        [revision_uid] => 1
        [body] => Array
            (
                [und] => Array
                    (
                        [0] => Array
                            (
                                [value] => summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text 
                                [summary] => 
                                [format] => filtered_html
                                [safe_value] => <p>summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text</p>

                                [safe_summary] => 
                            )

                    )

            )

        [field_video_category] => Array
            (
                [und] => Array
                    (
                        [0] => Array
                            (
                                [tid] => 25
                            )

                    )

            )

        [field_featured] => Array
            (
            )

        [field_kaltura_video] => Array
            (
            ) und 0 taxonomy term->name

        [field_episode_tags] => Array
            (
                [und] => Array
                    (
                        [0] => Array
                            (
                                [tid] => 95
                                [taxonomy_term] => stdClass Object
                                    (
                                        [tid] => 95
                                        [vid] => 1
                                        [name] => zen
                                        [description] => 
                                        [format] => 
                                        [weight] => 0
                                        [vocabulary_machine_name] => tags


                       [rdf_mapping] => Array
4

1 に答える 1

1

括弧 [] なしでインスタンス データメンバーに直接アクセスする必要があります。これらは配列キーに使用されます。

 print $node->field_episode_tags[LANGUAGE_NONE]['0']['taxonomy_term']->name
于 2013-10-07T09:05:06.560 に答える