2013-12-13 37 views
0

我需要一些关于PHP输出的帮助。其实我试图显示一条消息,但作为回报,它显示页面上的多条消息。PHP输出消息

OUTPUT: 这里有一些questionsHere一些questionsHere一些questionsHere一些问题

这里是我的代码:见线#2

function sc_wptabtitle($atts, $content = null) { 
echo '<span class="acbar">Here are some questions</span>'; 
    extract(shortcode_atts(array(
     'header' => 'h3', 
     'hclass' => 'wp-tab-title', 
     'label'  => 'text', 
     'image_size'=> '24,24', 
     '_id'  => false, 
     'load'  => '', 
     'post'  => '', 
     'page'  => '', 
     'cat'  => '', 
     'category_name' => '', 
     'tag'  => '', 
     'tag_name'  => '', 
     'number' => '4', 
     'exclude' => '', 
     'tag'  => '', 
     'feed'  => '', 
     'hide'  => "false", 
     'elength' => $this->options['excerpt_length'], 
     'before_post' => '', 
     'after_post' => '', 
     'template'  => '1', 
     'icon'  => false 
    ), $atts)); 

    global $wpui_id_remove_chars; 

    if (str_ireplace($wpui_id_remove_chars, '', $_id) != $_id) 
     $_id = false; 

    $tmpl = (isset($this->options[ 'post_template_' . $template ])) ? 
       $this->options[ 'post_template_' . $template ] : 
       $this->options[ 'post_template_1' ]; 

    if (isset($this->options[ 'title_template' ]) && $this->options[ 'title_template' ] != '') { 
     $title_template = $this->options[ 'title_template' ]; 
     if ($_id) { 
      $title_template = str_ireplace('>{$title}', 'id="' . $_id . '">{$title}', $title_template); 
     } 
    } else { 
     $title_template = '<' . $header; 
     $title_template .= ' class="' . $hclass . '"'; 
     if ($_id) { 
      $title_template .= ' id="' . $_id . '"'; 
     } 
     $title_template .= '>{$title}</' . $header . '>'; 
    } 

任何猜测为什么它在输出页面上显示多条消息/文本行?

非常感谢你提前

回答

0

因为你在你的代码中调用该函数sc_wptabtitle多次。

所以它是

echo '<span class="acbar">Here are some questions</span>'; 

多次调用下面的代码,它是给这样的输出。

检查你的代码,它在哪里调用。可能会在循环或多次调用。

+0

是的,我知道,但是有什么办法可以让它在输出页面上只显示一条消息吗? – user3088482