echo from php “as it goes”

前端 未结 6 1886
耶瑟儿~
耶瑟儿~ 2021-01-20 18:27

what was the way to print results from a php script while it\'s printing stuff before the script ends? i tried to play with output buffer, putting sleep() between echos to t

6条回答
  •  难免孤独
    2021-01-20 18:49

    Nice question.. when I want to do something like that (like loggin actions) I just use AJAX. And I know it's not probably what you wanted but hear me out.. I have had this problem as well 4 times so far and I've used AJAX and because of that I was able to put a preloader (which is really cool and helpful :))

    By "use ajax" I mean if you have 4 actions to show up do 4 ajax requests. I know it's not the most elegant solution (as you do a lot of extra stuff) but it is a good design-wise solution.

提交回复
热议问题