【问题标题】:finding length of multi-value field查找多值字段的长度
【发布时间】:2010-08-02 19:09:13
【问题描述】:

我在 drupal 节点中有一个多值 cck 字段。该字段称为field_multip。我需要知道该字段中的项目数,例如下例中的 3 个

我原以为length 可以解决问题,但$node->field_multip.length$node->field_multip.length() 都不适合我。

field_multip
   [0] 
      [id]
      [sec]
   [1]
      [id]
      [sec]
   [2]
      [id]
      [sec]

【问题讨论】:

    标签: php drupal


    【解决方案1】:

    你想使用count()

    $itemcount = count($node->field_multip);
    

    应该这样做。

    【讨论】:

      猜你喜欢
      • 2011-03-20
      • 2014-11-29
      • 2022-10-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-16
      • 2017-06-13
      相关资源
      最近更新 更多