Php while循环中的链接只给我最后一个href值,而不是全部

Php while循环中的链接只给我最后一个href值,而不是全部,php,wordpress,while-loop,href,Php,Wordpress,While Loop,Href,我正忙于一个项目,在这个项目中,我使用了acf repeater字段,我必须循环使用四个不同的href。链接正在从数据库中提取,但无论单击哪个选项,都只会打开最后一个链接 <?php if( have_rows('slider_splash') ):?> <?php while ( have_rows('slider_splash') ) : the_row();?> <li>

我正忙于一个项目,在这个项目中,我使用了acf repeater字段,我必须循环使用四个不同的href。链接正在从数据库中提取,但无论单击哪个选项,都只会打开最后一个链接

<?php if( have_rows('slider_splash') ):?>
                <?php while ( have_rows('slider_splash') ) : the_row();?>
                    <li>
                        <?php $str = get_sub_field('text_slider');
                            $str = strtoupper($str);
                            echo "<h2 class='splash-type'>$str<h2>"
                         ?>

                    <?php 
                    $image = get_sub_field('image_slider');
                        if( !empty($image) ): ?>
                        <img src="<?php echo $image['url']; ?>" 
                          alt="<?php echo $image['alt']; ?>" />
                        <div >

                            <p><?php the_sub_field('footer_text');?></p>
                            <a href="<?php the_sub_field('link_type');?>">
                                <?php
                                $str = get_sub_field('description_link');
                                $str = strtoupper($str);
                                echo "$str" 
                                ?>
                               </a>
                            <div class="clear-float"></div>
                        </div>

                    <?php endif; ?>

                    </li>
                <?php endwhile;
                else :  // no rows found
                endif;?>


  • 你确定“链接类型”是要显示的正确字段吗?是的,我非常确定该字段(链接类型)包含绝对url。ie@GrzegorzPawlik循环中有四个,所以它循环。但只有永远开放。