ob_flush(); flush(); 1-100顯示

 
<script type="text/javascript">  
function shownum(width) {  
    document.getElementById('notice').innerHTML = '<p>' + width + '</p>';  
}  
</script>  
  
<?php  
    function showjsmessage($width)  
    {  
        echo '<script type="text/javascript">shownum(\'' . $width . '\');</script>';  
        // echo $width;//這樣是不行的
        ob_flush();  
        flush();  
    }  




    $totalnum = 100;  
    for ($i = 1; $i <= $totalnum; $i++) {  
        $width = $i/$totalnum * 100;  
        showjsmessage($width);  
        usleep(10000);  
    }  
?>  
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章