Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/264.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在PHP(Wordpress)循环中,如何生成唯一数字序列?_Php_Wordpress_Loops_Integer - Fatal编程技术网

在PHP(Wordpress)循环中,如何生成唯一数字序列?

在PHP(Wordpress)循环中,如何生成唯一数字序列?,php,wordpress,loops,integer,Php,Wordpress,Loops,Integer,如果在循环中生成一个列表,类似于: <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> <div id="slide"> <ul> <li class="slide-<?php //how can I generate an integer here ?>"> <a href="#">stuff</a></li> <

如果在循环中生成一个列表,类似于:

<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<div id="slide">
<ul>
<li class="slide-<?php //how can I generate an integer here ?>">
<a href="#">stuff</a></li>
</ul>
</div>

    
    
      
      

        我在考虑你会把一些幻灯片放在同一页上。所以我会把所有的HTML代码放在PHP代码中。诸如此类:

        <?php
            while ($count <= $total) {
                echo "<div id=\"slide\">";
                echo "<ul>";
                echo "<li class=\"slide-".$count."\">";
                echo "<a href=\"#\">stuff</a></li>";
                echo "</ul>";
                echo "</div>";
        
                count++;
            }
        ?>
        
        
        
        我没有检查代码,但这只是一个想法


        祝你好运。

        我在考虑你会把一些幻灯片放在同一页上。所以我会把所有的HTML代码放在PHP代码中。诸如此类:

        <?php
            while ($count <= $total) {
                echo "<div id=\"slide\">";
                echo "<ul>";
                echo "<li class=\"slide-".$count."\">";
                echo "<a href=\"#\">stuff</a></li>";
                echo "</ul>";
                echo "</div>";
        
                count++;
            }
        ?>
        
        
        
        我没有检查代码,但这只是一个想法

        祝你好运