日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Smarty foreach

發布時間:2024/4/15 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Smarty foreach 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

2019獨角獸企業重金招聘Python工程師標準>>>

Smarty - Manua手冊 - Chapter 7. Built-in Functions第7章 內建函數 - {foreach},{foreachelse}用于像訪問序數數組一樣訪問關聯數組

{foreach},{foreachelse}

Attribute Name屬性名稱 Type類型 Required必要 Default默認值 Description描述
from array數組 Yes必要 n/a The array you are looping through
循環訪問的數組
item string字符串 Yes必要 n/a The name of the variable that is the current element
當前元素的變量名
key string字符串 No可選 n/a The name of the variable that is the current key
當前鍵名的變量名
name string字符 No可選 n/a The name of the foreach loop for accessing foreach properties
用于訪問foreach屬性的foreach循環的名稱
  • from和item是必要屬性
  • {foreach}循環的name可以是任何字母,數組,下劃線的組合,參考PHP變量。
  • {foreach}循環可以嵌套,嵌套的{foreach}的名稱應當互不相同。
  • The?from?attribute, usually an array of values, determines the number of times?{foreach}?will loop.

  • from屬性通常是值數組,被用于判斷{foreach}的循環次數。
  • {foreachelse}?is executed when there are no values in the?from?variable.

  • 在from變量中沒有值時,將執行{foreachelse}。
  • {foreach}循環也有自身屬性的變量,可以通過{$smarty.foreach.name.property}訪問,其中"name"是name屬性。

    • {foreach}?properties are?index,?iteration,?first,?last,?show,?total.

    • {foreach}屬性有index, iteration, first, last, show, total.

轉載于:https://my.oschina.net/u/162418/blog/122833

總結

以上是生活随笔為你收集整理的Smarty foreach的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。