发送响应JSON后如何重定向到另一个链接

时间:2019-05-03 09:33:57

标签: php codeigniter redirect codeigniter-restserver

我使用codeigniter-restserver使API变得安静,以接收来自其他网站的POST请求,但在发送响应json之后,便出现了scema错误,我必须重定向到另一个网站以确认我已收到transaction_id和signature_id

我的代码是这样的

/ untuk menambah person menaggunakan method post
        public function notification_post(){
            //untuk menerima data
            $result = json_decode(file_get_contents('php://input'), true);

            $order_id                   = $result['order_id'];
            $transaction_id         = $result['transaction_id'];
            $signature_key          = $result['signature_key'];

            $response = $this->km->confirm_payment(
                    $order_id,
                    $transaction_id,
                    $signature_key
                );

            $this->response($response);

            //sent to v2/update
            $confirm_order = array(
                'transaction_id' => $transaction_id,
                'signature_key'  => $signature_key,
            );


            //redirect ke halaman confirm
            $link = 'http://68731fea.ngrok.io/matoa-admin/transaksi/confirm';

            redirect($link, 'location');
        }

问题是,发送$ this-> response($ response);后如何重定向到$ link?

enter image description here

0 个答案:

没有答案