php将标头位置重定向到电话号码 [英] php redirect header location to phone number
问题描述
我正试图通过php将用户对链接的点击重定向到通过php的电话:
I'm trying to redirect the user's click on a link to a telephone number through php like this:
//HTML
<a href="tele.php">
和php:
<?php
header("Location: tel:+123456789");
exit;
?>
这在较新的移动浏览器上有效,但不适用于较旧的浏览器,尤其是诺基亚WAP2.0浏览器. 有想法吗,朴素?
This works on newer mobile browsers but won't on the older ones in particular Nokia WAP2.0 browser. Any ideas, plaese?
推荐答案
经过几次试验,我已经找到了解决方案.
I've found a solution after few trials.
我在主域中设置了一个第三级域:call.mydomain.it
.
我在其文档根目录中放置了一个包含以下行的index.php
文件:
I set up a third-level domain of my main domain: call.mydomain.it
.
In its docroot I placed an index.php
file containing these lines:
<?php
if(isset($_GET['tel']) && $_GET['tel'] != "")
{
$tel = $_GET['tel'];
header("Location: tel://$tel");
}
die();
?>
因此,当我加载call.mydomain.it/?tel=00393331234567
时,浏览器将开始调用作为参数传递的数字.
So, when I load call.mydomain.it/?tel=00393331234567
the browser starts a call to the number passed as argument.
此外,如果您必须设置网络营销活动,则可以使用这个免费工具
Further on, if you have to setup a web marketing campaign, you can shrink this url with this free tool
希望对您有帮助
这篇关于php将标头位置重定向到电话号码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!