Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.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代码重定向到我网站的另一个页面?_Php_Variables_Redirect_Sms_Bulksms - Fatal编程技术网

如何用PHP代码重定向到我网站的另一个页面?

如何用PHP代码重定向到我网站的另一个页面?,php,variables,redirect,sms,bulksms,Php,Variables,Redirect,Sms,Bulksms,这是一个批量短信发送代码,它工作正常并发送消息,但在发送消息后,web浏览器会将我重定向到白色页面中的代码 我想在发送消息后重定向到我网站上的另一个页面 $username = ''; $password = ''; $client = new SoapClient('http://www.xxxx/xx'); $numbers = 'xxxx '; $message = 'hi this is a test !@#$%^&*

这是一个批量短信发送代码,它工作正常并发送消息,但在发送消息后,web浏览器会将我重定向到白色页面中的代码

我想在发送消息后重定向到我网站上的另一个页面

$username = '';
    $password = '';
    $client = new SoapClient('http://www.xxxx/xx');
    $numbers = 'xxxx ';
    $message = 
    'hi this is a test 
    !@#$%^&*
    ';
    $senderName = 'xxxxxx';
    try {
    $response = $client->sendSMS($username, $password, $numbers, $message, $senderName);
    var_dump($response);
    } catch(SoapFault $exception ) {
    echo $exception->faultcode . ' : ' .$exception->faultstring . PHP_EOL;
    }

您可以使用标题重定向到新页面:

header('Location: http://www.yoursite.com/new_page.html');
使用此代码

header('Location: http://www.yoursite.com/new_page.html');
但请记住,如果php脚本已经发送了任何输出,那么它将不起作用。如果是这样,您将得到警告(检查错误报告并在php.ini中显示错误)。
所以,换句话说,您不能将它放在var_dump之后,因为var_dump产生输出。将exit()放在var_dump之后也是一个好主意。

使用此PHP代码头
('location:http://www.google.com)

下面是javascript代码:

<script>
    window.location = 'http://www.google.com'   
</script>

window.location=http://www.google.com'   
----------
----------
您可以使用

header('Location: your_url.php');
或者你也使用

?>
<script> window.location="your_url.php" </script>   
<?php 
?>
window.location=“your_url.php”

我尝试了THQT,但不起作用。请确保您将它放在
$response=$client->sendSMS($username、$password、$numbers、$message、$senderName)之后的代码中;var_dump($response)警告:无法修改标题信息-标题已由/home/content/43/11678743/html/click/sms.php:9中的/home/content/43/11678743/html/click/sms.php在线发送19@hossam365显然,您的输出位于其中一个文件之上,并且可能位于其中一个包含的文件中。任何高于

header('Location: your_url.php');
?>
<script> window.location="your_url.php" </script>   
<?php