我嘗試迭代使用數組的foreach循環並通過睡眠函數進行調度。批處理顯示迭代結果並隱藏foreach循環php
下面是我的代碼:
<?php
$result = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
$get_count = 4;
$delay = 2;
foreach ($result as $row)
{
echo $row."<br>";
$countx++;
if(($countx % $get_count)==0)
{
sleep($delay);
}
}
?>
我得到的輸出是
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
,我想輸出是要顯示在批次和隱藏previos批:
1
2
3
4
Hide above result and show nxt batch
5
6
7
8
Hide above result and show nxt batch
9
10
11
12
Hide above result and show nxt batch
13
14
15
16
任何幫助嗎?
的可能的複製[什麼是客戶端和服務器端編程的區別?(http://stackoverflow.com/questions/13840429/what-is-the-difference-between-client-服務器端編程) –
@u_mulder其不重複 –
PHP無法在客戶端首次顯示之後隱藏任何內容。使用JS的那 –