Home >Backend Development >PHP Tutorial >How to output in advance in PHP_PHP tutorial

How to output in advance in PHP_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:51:181044browse

D0000D sent to the forum section--------------------------------------------- -------------
No.0 plate dedecms
D8888D post title------------------------------------------------- ----------
How to output in advance in PHP
D8888D main post content------------------------------------------------- ----------
The following is a question I know on Baidu, please help the experts here. Thank you

Because I need to drive an infinite loop of while(1) through access, I want to return a notification to the browser before while(1) that the startup is successful. In short, it means to make the browser think that the page has ended. In fact, there is still something on the server. Running.
To put it simply, it is similar to the die() function, which outputs a piece of information but does not exit the script.
The function I want to do is also a button on the client. After clicking it, the server will do this infinite loop and notify the client that it has started.
Please tell me how to deal with the above situation
Question added: Pan Zhanfeng:
The first PHP output control uses flush and ob_flush to buffer the output, but the browser does not think that the script has ended. For example, if I use AJAX to ask this page, Ajax will not receive the result. In addition, my key is that it will Making an infinite while loop, I hope to notify the browser to start the loop before looping. In addition, if fopen() is used to query the processing file, it can also end.
As for the second php tutorial: How to use for loop in PHP programming, I don’t understand how it is related to my problem

Let me answer




D8888D reply content------------------------------------------------- ----------
The question is too advanced for a novice to understand.

D8888D reply content------------------------------------------------- ----------
I don’t quite understand what you mean


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632570.htmlTechArticleD0000D sent to the forum section------------------ ------------------------------------ No.0 plate dedecms D8888D post title ------ ----------------------------------------------- PHP How to...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn