久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <bdo id='YLnZg'></bdo><ul id='YLnZg'></ul>
      <tfoot id='YLnZg'></tfoot>
      1. <small id='YLnZg'></small><noframes id='YLnZg'>

        <i id='YLnZg'><tr id='YLnZg'><dt id='YLnZg'><q id='YLnZg'><span id='YLnZg'><b id='YLnZg'><form id='YLnZg'><ins id='YLnZg'></ins><ul id='YLnZg'></ul><sub id='YLnZg'></sub></form><legend id='YLnZg'></legend><bdo id='YLnZg'><pre id='YLnZg'><center id='YLnZg'></center></pre></bdo></b><th id='YLnZg'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='YLnZg'><tfoot id='YLnZg'></tfoot><dl id='YLnZg'><fieldset id='YLnZg'></fieldset></dl></div>
      2. <legend id='YLnZg'><style id='YLnZg'><dir id='YLnZg'><q id='YLnZg'></q></dir></style></legend>
      3. 如何在php中的foreach語句的每三個結(jié)果上輸出一個

        How to output a value on every third result of a foreach statement in php?(如何在php中的foreach語句的每三個結(jié)果上輸出一個值?)

            <legend id='1uBXT'><style id='1uBXT'><dir id='1uBXT'><q id='1uBXT'></q></dir></style></legend>
                <tbody id='1uBXT'></tbody>
            1. <tfoot id='1uBXT'></tfoot>

              <small id='1uBXT'></small><noframes id='1uBXT'>

            2. <i id='1uBXT'><tr id='1uBXT'><dt id='1uBXT'><q id='1uBXT'><span id='1uBXT'><b id='1uBXT'><form id='1uBXT'><ins id='1uBXT'></ins><ul id='1uBXT'></ul><sub id='1uBXT'></sub></form><legend id='1uBXT'></legend><bdo id='1uBXT'><pre id='1uBXT'><center id='1uBXT'></center></pre></bdo></b><th id='1uBXT'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='1uBXT'><tfoot id='1uBXT'></tfoot><dl id='1uBXT'><fieldset id='1uBXT'></fieldset></dl></div>
                • <bdo id='1uBXT'></bdo><ul id='1uBXT'></ul>

                  本文介紹了如何在php中的foreach語句的每三個結(jié)果上輸出一個值?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我的應(yīng)用程序中有一個 foreach 語句,用于回顯我的數(shù)據(jù)庫結(jié)果列表:

                  ';回聲 $fp['project_name'];回聲'</div>';}?>

                  我想:

                  每隔三個結(jié)果,給 div 一個不同的類.我怎樣才能做到這一點(diǎn)?

                  解決方案

                  您可以使用計數(shù)器和 模數(shù)/模數(shù)運(yùn)算符如下:

                  I have a foreach statement in my app that echos a list of my database results:

                  <?php
                  
                  foreach($featured_projects as $fp) {
                    echo '<div class="result">';
                    echo $fp['project_name'];
                    echo '</div>';
                  }
                  
                  ?>
                  

                  I would like to:

                  On every third result, give the div a different class. How can I achieve this?

                  解決方案

                  You can use a counter and the modulo/modulus operator as per below:

                  <?php
                  
                  // control variable
                  $counter = 0;
                  
                  foreach($featured_projects as $fp) {
                  
                      // reset the variable
                      $class = '';
                  
                      // on every third result, set the variable value
                      if(++$counter % 3 === 0) {
                          $class = ' third';
                      }
                  
                      // your code with the variable that holds the desirable CSS class name
                      echo '<div class="result' . $class . '">';
                      echo $fp['project_name'];
                      echo '</div>';
                  }
                  
                  ?>
                  

                  這篇關(guān)于如何在php中的foreach語句的每三個結(jié)果上輸出一個值?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  MySQLi prepared statement amp; foreach loop(MySQLi準(zhǔn)備好的語句amp;foreach 循環(huán))
                  Is mysqli_insert_id() gets record from whole server or from same user?(mysqli_insert_id() 是從整個服務(wù)器還是從同一用戶獲取記錄?)
                  PHP MySQLi doesn#39;t recognize login info(PHP MySQLi 無法識別登錄信息)
                  mysqli_select_db() expects exactly 2 parameters(mysqli_select_db() 需要 2 個參數(shù))
                  Php mysql pdo query: fill up variable with query result(Php mysql pdo 查詢:用查詢結(jié)果填充變量)
                  MySQLI 28000/1045 Access denied for user #39;root#39;@#39;localhost#39;(MySQLI 28000/1045 用戶“root@“l(fā)ocalhost的訪問被拒絕)
                      <tbody id='hP4nA'></tbody>

                    <i id='hP4nA'><tr id='hP4nA'><dt id='hP4nA'><q id='hP4nA'><span id='hP4nA'><b id='hP4nA'><form id='hP4nA'><ins id='hP4nA'></ins><ul id='hP4nA'></ul><sub id='hP4nA'></sub></form><legend id='hP4nA'></legend><bdo id='hP4nA'><pre id='hP4nA'><center id='hP4nA'></center></pre></bdo></b><th id='hP4nA'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='hP4nA'><tfoot id='hP4nA'></tfoot><dl id='hP4nA'><fieldset id='hP4nA'></fieldset></dl></div>
                    • <bdo id='hP4nA'></bdo><ul id='hP4nA'></ul>
                    • <tfoot id='hP4nA'></tfoot>

                      <small id='hP4nA'></small><noframes id='hP4nA'>

                            <legend id='hP4nA'><style id='hP4nA'><dir id='hP4nA'><q id='hP4nA'></q></dir></style></legend>
                            主站蜘蛛池模板: 99久久免费精品国产男女高不卡 | 久久精品亚洲 | 成人av电影在线 | 色综合欧美 | 久久综合av | 日韩一区二区三区在线观看 | 久久久久久综合 | 99精品国产一区二区青青牛奶 | 国产精品福利视频 | 免费看片国产 | 日韩成人中文字幕 | 91精品久久久久久久久久入口 | 亚洲性视频 | 婷婷色在线 | 四虎成人免费视频 | 国产成人免费视频网站视频社区 | 日韩精品一区二区三区在线播放 | 成人在线观看免费 | 2020亚洲天堂 | 久久99精品久久久久久秒播九色 | 亚洲精彩视频在线观看 | 色婷婷一区 | 91久久精品日日躁夜夜躁国产 | 日本特黄a级高清免费大片 国产精品久久性 | 最新黄色在线观看 | 2020天天操 | 亚洲欧美日韩中文在线 | 国产一区二区三区日韩 | av网站免费观看 | 7777久久 | 羞羞网站在线免费观看 | 人人人人干| 精精精精xxxx免费视频 | 中文字幕高清 | 亚洲在线日韩 | 亚洲精品不卡 | jlzzjlzz欧美大全 | 国产精品一区一区 | 国产成人短视频在线观看 | 久久99精品久久久久蜜桃tv | 99久久精品免费看国产小宝寻花 |