【问题标题】:PHP: Twitter button doesn't show text + linkPHP:Twitter 按钮不显示文本+链接
【发布时间】:2013-01-10 16:36:58
【问题描述】:

这是生成的推特按钮,我在里面添加了文字。

> <iframe allowtransparency="true" frameborder="0" scrolling="no"
> src="http://platform.twitter.com/widgets/tweet_button.1357735024.html#_=1357817606773&amp;count=horizontal&amp;id=twitter-widget-0&amp;lang=en&amp;original_referer=&amp;size=m&amp;text=<?php
> echo $art["title"].'
> http://web.com/article.php?art_id='.$art["id"];?>&amp;url=<?php
> echo
> 'http://web.com/article.php?art_id='.$art[id];?>&amp;via=MyWeb"
> class="twitter-share-button twitter-count-horizontal" style="width:
> 107px; height: 20px;" title="Twitter Tweet Button"
> data-twttr-rendered="true"></iframe>

问题是,我无法在推文中添加链接。当我在那里添加它时,即使是简单的文本也没有显示。

有没有类似的问题或帮助,如何解决?

谢谢

【问题讨论】:

    标签: php twitter hyperlink share


    【解决方案1】:

    我会稍微重新组织一下您的代码,以使 iframe src 的构建更易于遵循(那里可能存在错误)。您还应该确保 $art['title'] 是 urlencoded。

     <?php
        $iframe_src  = 'http://platform.twitter.com/widgets/tweet_button.1357735024.html#_=1357817606773&amp;count=horizontal&amp;id=twitter-widget-0&amp;lang=en&amp;original_referer=&amp;size=m&amp;text=';
        $iframe_src .= urlencode($art['title']);
        $iframe_src .= 'http://web.com/article.php?art_id='.$art['id'];
        $iframe_src .= '&amp;url=http://web.com/article.php?art_id='.$art['id'].'&amp;via=MyWeb';
    ?>
     <iframe allowtransparency="true" frameborder="0" scrolling="no" src="<?php echo $iframe_src; ?>"  
        class="twitter-share-button twitter-count-horizontal" 
        style="width:107px; height: 20px;" title="Twitter Tweet Button"
        data-twttr-rendered="true"></iframe> 
    

    【讨论】:

      猜你喜欢
      • 2018-09-26
      • 1970-01-01
      • 1970-01-01
      • 2013-11-10
      • 2019-12-05
      • 1970-01-01
      • 1970-01-01
      • 2022-10-24
      • 2018-07-18
      相关资源
      最近更新 更多