【发布时间】:2018-05-22 01:34:25
【问题描述】:
我想在我的网站上添加 twitter 按钮。 我使用的代码是:
echo"<iframe src='https://www.facebook.com/plugins/share_button.php?href=http%3A%2F%2Fconnecting-youth.org%2Fsingle_news.php%3Fsubmit%3D".$lastnum."&layout=button_count&size=small&mobile_iframe=true&width=69&height=20&appId' width='69' height='20' style='border:none;overflow:hidden' scrolling='no' frameborder='0' allowTransparency='true'></iframe>
<a style='margin-left:10px;' class='twitter-share-button' href='https://twitter.com/share?url=http%3A%2F%2Fconnecting-youth.org%2Fsingle_news.php%3Fsubmit%3D".$lastnum."' data-size='large'>Tweet</a>
";
当我添加另一个 URL 时它工作正常。
【问题讨论】:
-
如果那是您使用的 exact 代码,那么您需要回显 php 变量以将其包含在 url 中:
<a class='twitter-share-button' href='https://twitter.com/share?url=http%3A%2F%2Fconnecting-youth.org%2Fsingle_news.php%3Fsubmit%3D<?php echo $lastnum; ?>' data-size='large'>Tweet</a>否则,您能请包括您正在使用的整行代码?此外,非工作和工作链接的示例输出将非常有帮助。 -
@mtr.web 我包含了整行代码。在任何情况下,该链接都已正确粘贴到 Twitter 上,但它没有显示为应有的(输出显示在问题中包含的捕获中)