Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从php转到url并执行其余代码_Php_Jquery_Ajax - Fatal编程技术网

从php转到url并执行其余代码

从php转到url并执行其余代码,php,jquery,ajax,Php,Jquery,Ajax,这段php代码是使用ajax执行的。Ajax请求在执行header语句后不会返回 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=*****

这段php代码是使用ajax执行的。Ajax请求在执行header语句后不会返回

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调用此代码时执行其余部分。除了header之外,还有其他方法可以转到链接并在php中执行其余代码。

replace

 header("Location: $sms");


您不能告诉浏览器它应该同时显示来自不同URL的内容和来自当前URL的内容


听起来您应该从服务器向domain.com URL发出HTTP请求,在这种情况下,您应该查看而不是标题。

研究一下为什么要通过GET请求发送密码?Sms网关api是这样的。尝试过这种方法后,代码将完全执行,但是没有收到短信。尝试了以下代码$curl=curl\u init;curl_setopt_数组$curl,数组CURLOPT_RETURNTRANSFER=>1,CURLOPT_URL=>sms,CURLOPT_USERAGENT=>sms$resp=curl\u exec$curl;curl_close$curl;代码执行时没有错误,但没有收到短信。
 @file_get_contents($sms);