smarty模板中判斷數組為空白的方法_PHP教程

來源:互聯網
上載者:User
在smarty模板中判斷數組是否為空白有兩種方法,下面一一舉例分享。

(1)使用php count函數

{if $array|@count gt 0}... ...{/if}

(2)這個寫法很奇怪,今天是因為第一種方法不行了才在網上找找看,就找到下面這種奇怪的寫法了。

{if count($array) gt 0}... ...{/if}

您可能感興趣的文章

  • thinkphp模板中判斷volist迴圈的最後一條記錄
  • smarty模板中如何產生隨機數
  • smarty模板中使用php函數以及smarty模板中如何對一個變數使用多個函數
  • smarty 模板中迴圈表格補充不全的td
  • smarty模板中給資訊添加最新標籤
  • smarty模板中for迴圈的擴充外掛程式
  • js中判斷一個數組中是否有重複值的方法
  • 程式中通過define定義的常量如何在smarty模板中使用

http://www.bkjia.com/PHPjc/764118.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/764118.htmlTechArticle在smarty模板中判斷數組是否為空白有兩種方法,下面一一舉例分享。 (1)使用php count函數 {if $array|@count gt 0}... ...{/if} (2)這個寫法很奇怪,...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.