我有一个简单的 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/