如何使用 Facebook、LinkedIn 和 Twitter 分享按钮分享当前页面?
How to share the current page with the Facebook,LinkedIn and Twitter Share Button?
如果这个问题已经被问过,我很抱歉,但这种情况不同。我正在尝试制作一个共享当前 URL 的 Facebook 按钮,但我不知道该怎么做 this.My 问题是:我应该放什么而不是 'homepage' 以便这些按钮共享用户当前所在的页面而不是特定的 URL ?
这是当前代码的样子(我用主页替换了网站的 URL):
<a href="http://www.facebook.com/sharer.php?u='homepage' target="_blank" style="text-decoration:none">
<img src="http://image.noelshack.com/fichiers/2015/25/1434621881-iconmonstr-facebook-4-icon-32.png" alt="Facebook">
</a>
<!-- LinkedIn -->
<a href="http://www.linkedin.com/shareArticle?mini=true&url=homepage" target="_blank" style="text-decoration:none">
<img src="http://image.noelshack.com/fichiers/2015/25/1434621881-iconmonstr-linkedin-4-icon-32.png" alt="LinkedIn">
</a>
<!-- Twitter -->
<a href="https://twitter.com/share?url=homepage" target="_blank" style="text-decoration:none">
<img src="http://image.noelshack.com/fichiers/2015/25/1434621881-iconmonstr-twitter-4-icon-32.png" alt="Twitter">
</a>
// Get the current URL
<?php
$Url = (@$_SERVER["HTTPS"] == "on") ? "https://" : "http://";
$Url .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
?>
<a href="http://www.facebook.com/sharer.php?u=<?php echo $Url; ?>" target="_blank" style="text-decoration:none">
<img src="http://image.noelshack.com/fichiers/2015/25/1434621881-iconmonstr-facebook-4-icon-32.png" alt="Facebook">
</a>
<!-- LinkedIn -->
<a href="http://www.linkedin.com/shareArticle?mini=true&url=<?php echo $Url; ?>" target="_blank" style="text-decoration:none">
<img src="http://image.noelshack.com/fichiers/2015/25/1434621881-iconmonstr-linkedin-4-icon-32.png" alt="LinkedIn">
</a>
<!-- Twitter -->
<a href="https://twitter.com/share?url=<?php echo $Url; ?>" target="_blank" style="text-decoration:none">
<img src="http://image.noelshack.com/fichiers/2015/25/1434621881-iconmonstr-twitter-4-icon-32.png" alt="Twitter">
</a>
如果这个问题已经被问过,我很抱歉,但这种情况不同。我正在尝试制作一个共享当前 URL 的 Facebook 按钮,但我不知道该怎么做 this.My 问题是:我应该放什么而不是 'homepage' 以便这些按钮共享用户当前所在的页面而不是特定的 URL ? 这是当前代码的样子(我用主页替换了网站的 URL):
<a href="http://www.facebook.com/sharer.php?u='homepage' target="_blank" style="text-decoration:none">
<img src="http://image.noelshack.com/fichiers/2015/25/1434621881-iconmonstr-facebook-4-icon-32.png" alt="Facebook">
</a>
<!-- LinkedIn -->
<a href="http://www.linkedin.com/shareArticle?mini=true&url=homepage" target="_blank" style="text-decoration:none">
<img src="http://image.noelshack.com/fichiers/2015/25/1434621881-iconmonstr-linkedin-4-icon-32.png" alt="LinkedIn">
</a>
<!-- Twitter -->
<a href="https://twitter.com/share?url=homepage" target="_blank" style="text-decoration:none">
<img src="http://image.noelshack.com/fichiers/2015/25/1434621881-iconmonstr-twitter-4-icon-32.png" alt="Twitter">
</a>
// Get the current URL
<?php
$Url = (@$_SERVER["HTTPS"] == "on") ? "https://" : "http://";
$Url .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
?>
<a href="http://www.facebook.com/sharer.php?u=<?php echo $Url; ?>" target="_blank" style="text-decoration:none">
<img src="http://image.noelshack.com/fichiers/2015/25/1434621881-iconmonstr-facebook-4-icon-32.png" alt="Facebook">
</a>
<!-- LinkedIn -->
<a href="http://www.linkedin.com/shareArticle?mini=true&url=<?php echo $Url; ?>" target="_blank" style="text-decoration:none">
<img src="http://image.noelshack.com/fichiers/2015/25/1434621881-iconmonstr-linkedin-4-icon-32.png" alt="LinkedIn">
</a>
<!-- Twitter -->
<a href="https://twitter.com/share?url=<?php echo $Url; ?>" target="_blank" style="text-decoration:none">
<img src="http://image.noelshack.com/fichiers/2015/25/1434621881-iconmonstr-twitter-4-icon-32.png" alt="Twitter">
</a>