【问题标题】:How to add WhatsApp share button to PHP website?如何将 WhatsApp 分享按钮添加到 PHP 网站?
【发布时间】:2018-10-16 16:52:00
【问题描述】:

以下链接正在使用 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>

【问题讨论】:

  • 您的目标具体有什么问题?

标签: php share whatsapp


【解决方案1】:

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

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

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

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

例如: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

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

【讨论】:

    【解决方案2】:

    关于使用 URL Scheme 的意义何在?

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

    自定义网址方案

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

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

    随意添加其他信使..

    三里马:

    threema://compose?text=Hello

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

    电报:

    tg://msg?text= 或

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

    【讨论】:

      【解决方案3】:

      第一:Official Whatsapp Sharing Documentation。看看当您使用 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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-04-16
        • 1970-01-01
        • 2014-12-19
        • 1970-01-01
        • 2018-05-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多