php - 错误: The terms you entered did not bring any results with twitter share on mobile only

标签 php twitter share

我有一个简单的 Facebook、Twitter 和 Pinterest 分享按钮

<a href="<?php echo "$base_url/share.php"; ?>" class="btn btn-default btn-facebook btn-icon btn-block" target="popup" 
onclick="window.open('<?php echo "$base_url/share.php?id=$id&share=fb&type=article"; ?>','popup','width=600,height=600'); return false;"><i class="fab fa-facebook"></i> <span class="post-sharing__label d-none d-sm-inline-block">Share on Facebook</span></a>

<a href="<?php echo "$base_url/share.php"; ?>" class="btn btn-default btn-twitter btn-icon btn-block" target="popup" 
onclick="window.open('<?php echo "$base_url/share.php?id=$id&share=tw&type=article"; ?>','popup','width=600,height=600'); return false;"><i class="fab fa-twitter"></i> <span class="post-sharing__label d-none d-sm-inline-block">Share on Twitter</span></a>

<a href="<?php echo "$base_url/share.php"; ?>" class="btn btn-default btn-twitter btn-icon btn-block" target="popup" 
onclick="window.open('<?php echo "$base_url/share.php?id=$id&share=tw&type=article"; ?>','popup','width=600,height=600'); return false;"><i class="fab fa-twitter"></i> <span class="post-sharing__label d-none d-sm-inline-block">Share on Twitter</span></a>

当用户单击共享时,它会转到名为 share.php 的 php 文件;该文件获取有关将要共享的页面的信息。

if ($share =="tw"){     

header("Location: http://twitter.com/share?text=$seo_description&url=$share_url");
die();
}

在桌面上,它可以正常工作,但在移动设备上,我收到以下错误

The terms you entered did not bring any results, please try again later.

Facebook 和 Pinterest 在移动设备上运行,我正在苦苦思索为什么我会得到这个。

我在手机上登录的 Twitter 帐户与我在电脑上登录的帐户相同。

我从 this question 获取了我的网址信息

最佳答案

我通过更改链接在移动设备上实现了此功能

if ($share =="tw"){     

header("Location: http://twitter.com/share?text=$seo_description&url=$share_url");
die();
}

到此

if ($share =="tw"){     

header("Location: https://twitter.com/intent/tweet?text=$seo_description&url=$share_url");
die();
}

关于php - 错误: The terms you entered did not bring any results with twitter share on mobile only,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75444866/

相关文章:

php - 使用 jQuery 或 Javascript 查找下拉选项值

php - 如何转义 MYSQL 查询中的引号?

javascript - 从 vue-router 的链接获取 'id' 值

python - Twitter:如何提取包含符号 (!,%,$) 的推文?

pointers - 在多个 fork 进程之间共享指针

redirect - 谷歌加 : How to get feedback after sharing my content?

php - 在 MySQLi 中查找实际数据类型

android - 如何创建可以与所有客户端一起使用的 android 共享 Intent ?

node.js - Passport-Twitter - 错误 : Failed to find request token in session

ios - iOS 中带有大型类(class)对象的 Facebook 打开图形对象