0

这是批量 SMS 发送代码,它运行良好并发送消息,但发送消息后,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;
    }
4

6 回答 6

5

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

header('Location: http://www.yoursite.com/new_page.html');
于 2013-09-06T19:39:52.640 回答
2

您可以使用...

header('Location: your_url.php');

或者你也使用

?>
<script> window.location="your_url.php" </script>   
<?php 
于 2017-03-04T05:52:34.453 回答
0

使用此代码

header('Location: http://www.yoursite.com/new_page.html');

但请记住,如果 php 脚本已经发送了任何输出,它将不起作用。如果是这样,您将收到警告(检查 php.ini 中的 error_reporting 和 display_errors)。所以,换句话说,你不能把它放在 var_dump 之后,因为 var_dump 会产生输出。将 exit() 放在 var_dump 之后可能也是一个好主意。

于 2013-09-06T21:03:10.007 回答
0

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

这个javascript代码:

<script>
    window.location = 'http://www.google.com'   
</script>
于 2015-11-07T10:48:52.073 回答
0
----------
<?php
echo '<div style="text-align:center;padding-top:200px;">Go New Page</div>'; // Show Message
        $gourl='http://stackoverflow.com'; // goto url
        echo '<META HTTP-EQUIV="Refresh" Content="2; URL='.$gourl.'">'; //   Content= Redirect time (seconds)
        exit;

?>
----------
于 2017-03-03T05:37:35.220 回答
0
$username = '';
    $password = '';
    $client = new SoapClient('http://www.google.com/xx');
    $numbers = '8899';
    $message = 
    'hi check it
    !@#$%^&*
    ';
    $senderName = 'Winder';
    try {
    $response = $client->sendSMS($username, $password, $numbers, $message, $senderName)
    var_dump($response);
    } catch(SoapFault $exception ) {
    echo $exception->faultcode . ' : ' .$exception->faultstring . PHP_EOL;
    }
于 2016-05-31T14:28:07.297 回答