从file_get_contents()成功获取数据后,PHP重定向到另一个页面

问题描述 投票:0回答:1

我有一个弹出支付网关,我有一个公共推送网址,以了解银行的成功数据。

mysite.com/push_back
// push back url gave to bank in order to send back data 
function push_back() {
    $content = file_get_contents("php://input");
    $obj = json_decode($content);
    $tran_id = $obj->tran_id;
    $status = $obj->status;
    //insert into db successfully
    //redirect code is not working. eg: header("Location: http://example.com/myOtherPage.php");
}

注意:我创建了一个回推链接,并向银行提供其在后台运行以便为我发送数据。

HTML表格

<!— Modal content —>
<div class="modal-content">
    <form method="POST" target="webservice" action="payment-gateway-url" id="merchant_request">
        <input type="hidden" name="hash" value="asdfxc123sfd" id="hash"/>
        <input type="hidden" name="tran_id" value="123" id="tran_id"/>          
    </form>
</div>

<input type="button" value="confirm" id="button-confirm" class="btn btn-primary" /> 

<script type="text/javascript">
    $(document).on('click', '#button-confirm', function() {
        PaymentGateway.checkout();
    });
</script>

我已经成功从支付网关获得了回推数据。但是,我无法将执行重定向脚本写入另一个页面。好像代码没有执行。我试图搜索谷歌,但我没有找到正确的解决方案。

php redirect file-get-contents
1个回答
0
投票

最后,我从银行找到答案,他们将为我提供重定向链接选项。

© www.soinside.com 2019 - 2024. All rights reserved.