簡體   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