douyan4470 2019-05-04 03:21
浏览 50

为什么返回后的进程未在Controller Codeigniter中处理

I am developing an application with the help of another website API. In the scheme in one process I have to respond to the sign that I am receiving data details and in one state must send GET requests to their API again

this is the schme

my code is like this

public function confirm(){
        $result = json_decode(file_get_contents('php://input'), true);

        return $this->output
                    ->set_content_type('application/json')
                    ->set_status_header(200)
                    ->set_output(json_encode(array(
                        'status' => 'OK',
                        'message' => 'Message from merchant if any'
                    )));

        //kirim get untuk confirm order
        $url = $this->ci->config->item("kredivo_api_link_confirm");

        //load libary kredivo
        $this->load->library('CoreKredivo','corekredivo');

        //sent to v2/update
        $confirm_order = array(
            'transaction_id' => 'e75e5b62-5432-4d72-98b4-c5e938c6fbd9',
            'signature_key'  => 'a7Ijx%2FWgv02I4rvPQSld07uQO9TNMHg%2FFcJsS7EhA2GRKLgKiiYbYrHaLiuMKcG4cG98Iw0vTOPUgeHOZsPhqv3wvAGKgMDgEEMxMmZS3uXG0JIOzdFQc5s0zJ5qlhKZ',
        );

        //kirim data ke confirmation core kredivo
        $confirmation = $this->corekredivo->confirmOrder($url,$confirm_order);

        //menerima data dari core kredivo dan melakukan decode
        $finalResponse_payment = json_decode($confirmation,true);

        //untuk check
        $data = array(
            '_content' => 'shop/kredivo_2',
            '_title' => 'Tes Konfirmasi',
            '_respon' => $finalResponse_payment
        );

the problem is when I make a return in this section

return $this->output
                    ->set_content_type('application/json')
                    ->set_status_header(200)
                    ->set_output(json_encode(array(
                        'status' => 'OK',
                        'message' => 'Message from merchant if any'
                    )));

the process below is not executed, what is the cause? and maybe there are suggestions

  • 写回答

1条回答 默认 最新

  • duanluanhui8348 2019-05-04 20:45
    关注

    The return keyword stops the function's execution and returns back to the method calling it. Everything written below a return statement is ignored.

    评论

报告相同问题?

悬赏问题

  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行