此php代码使用ajax执行。Ajax请求在执行头语句后不会返回。
if(is_numeric($phone) && strlen($phone)==10){
$text = "Hi $name, your account created at hhhhh. Check your email to get updates. Thank you";
$sms = "http://domain.com/msg.php?user=******&pass=*****&sender=***&phone=$phone&text=$text&priority=****&stype=***";
header("Location: $sms");
}
$url = "done";
echo $url;
我需要的是,只需转到php中的$sms
url,并在通过ajax调用此代码时执行其余部分。除了头,还有其他方法可以转到链接并在php中执行剩余的代码吗。
替换
header("Location: $sms");
带有
@file_get_contents($sms);
您不能告诉浏览器它应该同时显示来自不同URL的内容和显示来自当前URL的内容。
听起来您应该从服务器向domain.com
URL发出HTTP请求,在这种情况下,您应该查看cURL而不是header()
。