代码之家  ›  专栏  ›  技术社区  ›  Space Spice

Php echo无法正确应用于文本

  •  -1
  • Space Spice  · 技术社区  · 7 年前

    <?php
    /*
    Plugin Name: blabla
    */
    function wp_first_shortcode(){
        echo "Hello, This is your another shortcode!";
    }
    add_shortcode('first', 'wp_first_shortcode');
    ?>
    

    在wp post中,我有一篇文章,如下所示:

    text text text [first] text text
    

    但我看到的结果是:

    [first]
    text text text text text
    

    [first]

    这里是指向实例www cpamethods的链接。com/instagram管理/

    1 回复  |  直到 7 年前
        1
  •  0
  •   Elentriel    7 年前

    在WordPress上的短代码上,返回,不回显

    <?php
    /*
    Plugin Name: blabla
    */
    function wp_first_shortcode(){
        return "Hello, This is your another shortcode!";
    }
    add_shortcode('first', 'wp_first_shortcode');
    ?>