警告:implode():传入的参数无效

时间:2014-10-03 10:14:38

标签: php implode

我收到以下错误:

Warning: implode(): Invalid arguments passed in ... index.php on line 19

请帮助我!

<?php if($mts_options['mts_featured_slider'] == '1') { ?>
                    <div class="slider-container loading">
                        <div class="flex-container">
                            <div id="slider" class="flexslider">
                                <ul class="slides">
                                    <!-- 19 row follows -->
                                    <?php $slider_cat = implode(",", $mts_options['mts_featured_slider_cat']); 
                                        $my_query = new WP_Query('cat='.$slider_cat.'&posts_per_page=4');
                                        while ($my_query->have_posts()) : $my_query->the_post();
                                        $image_id = get_post_thumbnail_id();
                                        $image_url = wp_get_attachment_image_src($image_id,'related');
                                        $image_url = $image_url[0]; ?>
                                    <li data-thumb="<?php echo $image_url; ?>"> 
                                        <a href="<?php the_permalink() ?>">
                                            <?php the_post_thumbnail('slider',array('title' => '')); ?>
                                            <div class="flex-caption">
                                                <p class="slidertitle"><?php the_title(); ?></p>
                                            </div>
                                        </a> 
                                    </li>
                                    <?php endwhile; wp_reset_query(); ?>
                                </ul>
                            </div>
                        </div>
                    </div>
                    <!-- slider-container -->
                <?php } ?>

1 个答案:

答案 0 :(得分:3)

第一个参数","有效。这意味着错误与数组$mts_options['mts_featured_slider_cat']有关。如果输出该数组的内容(使用var_dump($mts_options['mts_featured_slider_cat'])),您应该看到它有什么问题。如果没有,请发布输出,以便我们提供更多帮助。