纸壳CMS模板过滤器 - concat

纸壳CMS模板过滤器 - concat

ZKEASOFT August 28, 2018


concat

concat用于串联 (连接在一起) 多个数组。结果数组包含输入数组中的所有项。

输入

{% assign fruits = "apples, oranges, peaches" | split: ", " %}
{% assign vegetables = "carrots, turnips, potatoes" | split: ", " %}

{% assign everything = fruits | concat: vegetables %}

{% for item in everything %}
- {{ item }}
{% endfor %}

输出

- apples
- oranges
- peaches
- carrots
- turnips
- potatoes

可以多次使用连接多个数组

输入

{% assign furniture = "chairs, tables, shelves" | split: ", " %}

{% assign everything = fruits | concat: vegetables | concat: furniture %}

{% for item in everything %}
- {{ item }}
{% endfor %}

输出

- apples
- oranges
- peaches
- carrots
- turnips
- potatoes
- chairs
- tables
- shelves

第一时间了解最新动态

×

通过邮箱订阅我们,您将可以在第一时间收到我们的相关信息

微信公众号