duanbimo7212 2017-06-06 12:06
浏览 46
已采纳

在json输出后执行php

i am sending few data as json from php file and it works without any issue. but i want to keep executing php file after json output. if i comment this line then those php codes are executing else they are not executing.

header('Content-Type: application/json', true);
 some more code here
   exit(json_encode($response));

next is few more php codes which makes database connection and executes.

   $res2 = $con->query("SELECT * FROM `tableA` where status='0' order by id desc limit 5");

update code and change the status to 1 if i comment below code

      exit(json_encode($response));

then update code works and updates the status to 1 else it is 0. mainly because its a json file as per header and it advises to close the script execution after exit code. i tried toset header as none and echo the output but it does not work. i tried to flush also. it did not work either. any idea will be great

  • 写回答

2条回答 默认 最新

  • dpbsy60000 2017-06-06 12:10
    关注

    use echo instead of exit

    echo json_encode($response);
    

    exit will terminate code at that line.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 关于用pyqt6的项目开发该怎么把前段后端和业务层分离
  • ¥30 线性代数的问题,我真的忘了线代的知识了
  • ¥15 有谁能够把华为matebook e 高通骁龙850刷成安卓系统,或者安装安卓系统
  • ¥188 需要修改一个工具,懂得汇编的人来。
  • ¥15 livecharts wpf piechart 属性
  • ¥20 数学建模,尽量用matlab回答,论文格式
  • ¥15 昨天挂载了一下u盘,然后拔了
  • ¥30 win from 窗口最大最小化,控件放大缩小,闪烁问题
  • ¥20 易康econgnition精度验证
  • ¥15 msix packaging tool打包问题