繁体   English   中英

如何将 WhatsApp 分享按钮添加到 PHP 网站?

[英]How to add WhatsApp share button to PHP website?

以下链接使用 Facebook 和其他网络分享帖子

如何放置和链接 Whatsapp 分享按钮?

<a href="#" class="fa fa-facebook" onclick="OpenShareWindow('https://www.facebook.com/sharer/sharer.php?u={{ENCODED_URL}}')"></a>
               <a href="#" class="fa fa-twitter" onclick="OpenShareWindow('https://twitter.com/home?status={{ENCODED_URL}}')"></a>
               <a href="#" class="fa fa-google" onclick="OpenShareWindow('https://plus.google.com/share?url={{ENCODED_URL}}')"></a>
               <a href="#" class="fa fa-linkedin" onclick="OpenShareWindow('https://www.linkedin.com/shareArticle?mini=true&url={{ENCODED_URL}}&title={{TITLE}}')"></a>
               <a href="#" class="fa fa-pinterest" onclick="OpenShareWindow('https://pinterest.com/pin/create/button/?url={{ENCODED_URL}}&media={{THUMBNAIL}}')"></a>
               <a href="#" class="fa fa-tumblr" onclick="OpenShareWindow('http://www.tumblr.com/share/link?url={{ENCODED_URL}}')"></a>
               <a href="#" class="fa fa-reddit" onclick="OpenShareWindow('http://www.reddit.com/submit?url={{ENCODED_URL}}')"></a>

要创建您自己的链接,请使用https://wa.me/ ,其中 是国际格式的完整电话号码。 添加国际格式的电话号码时,请省略任何零、括号或破折号。 有关国际号码的详细说明,请阅读本文。 请记住,此电话号码必须在 WhatsApp 上拥有有效帐户。

使用: https : //wa.me/15551234567

不要使用: https : //wa.me/+001-(555)1234567

要使用自动出现在聊天文本字段中的预填充消息创建自己的链接,请使用https://wa.me/whatsappphonenumber/?text=urlencodedtext其中 whatsappphonenumber 是国际格式和 URL 的完整电话号码-encodedtext 是 URL 编码的预填充消息。

示例: https ://wa.me/15551234567?text = I 'm%20interested%20in%20your%20car%20for%20sale

要创建仅包含预填充消息的链接,请使用https://wa.me/?text=urlencodedtext

示例: https ://wa.me/?text = I'm%20inquiring%20about%20the%20apartment%20listing

单击链接后,您将看到一个联系人列表,您可以向其发送消息。

什么是使用 URL Scheme?

来自 WhatsApp 文档: https ://faq.whatsapp.com/en/android/28000012

自定义 URL 方案

WhatsApp 提供了一个自定义 URL 方案来与 WhatsApp 交互:

如果您有一个网站,并希望使用预先填写的消息打开 WhatsApp 聊天,您可以使用我们的自定义 URL 方案来执行此操作。 打开 whatsapp://send?text= 后跟要发送的文本,将打开 WhatsApp,允许用户选择联系人,并用指定的文本预填充输入字段。

随意添加其他信使..

三马:

Threema://compose?text=你好

见文档: https : //threema.ch/de/faq/url_actions

电报:

tg://msg?text= 或

tg://share?url=www.example.com?t=12&text=Check%20out%20this%20url

第一:官方Whatsapp共享文档 看看当您使用 WhatsApp 时会发生什么,但不要指明电话号码: http ://wa.me/?text=mytest。 我得到结果:

我们找不到您要找的页面

希望这不是您要分享的内容! 我强烈建议使用以下格式之一,不使用wa.me域,但使用api.whatsapp.com域:

https://api.whatsapp.com/send?text=YourShareTextHere

https://api.whatsapp.com/send?text=YourShareTextHere&phone=123

如果您有兴趣观看跟踪这些 URL 的项目,请查看我们!: https : //github.com/bradvin/social-share-urls#whatsapp

社交分享 URL

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM