【问题标题】:accessing an item in array in PHP在 PHP 中访问数组中的项目
【发布时间】:2009-05-09 11:18:08
【问题描述】:

在 PHP 中,我想获取客户名称标签的文本值。我写了这段代码,但这不起作用。你能帮我解决这个问题吗?谢谢

$customerName = $dom->get_elements_by_tagname("item");
$customernameValue = customerName[0]-> first_child()->node_value ();

【问题讨论】:

    标签: php arrays dom


    【解决方案1】:

    我不熟悉您使用的库,但看起来您只是错过了第二行 customerName 之前的 $。

    【讨论】:

      【解决方案2】:

      您缺少$ 符号,试试这个:

      $customerName = $dom -> get_elements_by_tagname ("item");
      $customernameValue = $customerName[0] -> first_child() -> node_value ();
      

      【讨论】:

        猜你喜欢
        • 2019-01-11
        • 2019-10-11
        • 2010-12-05
        • 2020-10-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多