field_view_value() takes a $display argument that you can use to hide the label:$display = array('label' => 'hidden');$view = field_view_field('node', $node, 'field_description', $display);print drupal_render($view);如果您只想提取字段的原始值,您可以使用 field_get_items() 代替:If you just want to extract the raw value of the field you can use field_get_items() instead:$items = field_get_items('node', $node, 'field_description');$first_item = array_shift($items);$description = $first_item['value'];列名称 ($first_item['whatever']) 将取决于您使用的字段类型.对于文本字段,它将是 value.请记住在输出之前使用 check_plain() 清理输入,因为 Drupal 的约定是存储原始输入数据并在输出时清理它.The column name ($first_item['whatever']) will depend on the type of field you're using. For text fields it will be value. Remember to sanitise the input with check_plain() before you output it as Drupal's convention is to store the raw input data and sanitise it upon output. 这篇关于仅打印 drupal field_view_field 值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-04 02:20
查看更多