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 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化