pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

<i id='lzLYW'><tr id='lzLYW'><dt id='lzLYW'><q id='lzLYW'><span id='lzLYW'><b id='lzLYW'><form id='lzLYW'><ins id='lzLYW'></ins><ul id='lzLYW'></ul><sub id='lzLYW'></sub></form><legend id='lzLYW'></legend><bdo id='lzLYW'><pre id='lzLYW'><center id='lzLYW'></center></pre></bdo></b><th id='lzLYW'></th></span></q></dt></tr></i><div class="9xj7jrx" id='lzLYW'><tfoot id='lzLYW'></tfoot><dl id='lzLYW'><fieldset id='lzLYW'></fieldset></dl></div>
    <tfoot id='lzLYW'></tfoot>
  1. <small id='lzLYW'></small><noframes id='lzLYW'>

  2. <legend id='lzLYW'><style id='lzLYW'><dir id='lzLYW'><q id='lzLYW'></q></dir></style></legend>

        <bdo id='lzLYW'></bdo><ul id='lzLYW'></ul>

    1. PHP 錯誤:ob_flush() [ref.outcontrol]:未能刷新緩沖區.沒

      PHP Error: ob_flush() [ref.outcontrol]: failed to flush buffer. No buffer to flush(PHP 錯誤:ob_flush() [ref.outcontrol]:未能刷新緩沖區.沒有緩沖區可以刷新)
        <bdo id='4kdbc'></bdo><ul id='4kdbc'></ul>
        <legend id='4kdbc'><style id='4kdbc'><dir id='4kdbc'><q id='4kdbc'></q></dir></style></legend>

            <tbody id='4kdbc'></tbody>

              <small id='4kdbc'></small><noframes id='4kdbc'>

            • <i id='4kdbc'><tr id='4kdbc'><dt id='4kdbc'><q id='4kdbc'><span id='4kdbc'><b id='4kdbc'><form id='4kdbc'><ins id='4kdbc'></ins><ul id='4kdbc'></ul><sub id='4kdbc'></sub></form><legend id='4kdbc'></legend><bdo id='4kdbc'><pre id='4kdbc'><center id='4kdbc'></center></pre></bdo></b><th id='4kdbc'></th></span></q></dt></tr></i><div class="xrn757n" id='4kdbc'><tfoot id='4kdbc'></tfoot><dl id='4kdbc'><fieldset id='4kdbc'></fieldset></dl></div>
              <tfoot id='4kdbc'></tfoot>
              1. 本文介紹了PHP 錯誤:ob_flush() [ref.outcontrol]:未能刷新緩沖區.沒有緩沖區可以刷新的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                有人可以保存這兩個文件并運行它們并告訴我為什么我收到錯誤ob_flush() [ref.outcontrol]: failed to refresh buffer. No buffer to refresh".我試著用谷歌搜索,它說我必須使用 ob_start();但是當我這樣做時,它不會逐行打印出來,而是在完成后從 FOR 循環中返回整個對象.我對 PHP 有點陌生,所以我不知道還有什么地方可以看..

                test_process.php

                //這個腳本會將 1 到 100 的數字寫入文件//并不斷向用戶發送信息$fp = fopen('/tmp/output.txt', 'w') or die('打開失敗');設置時間限制(120);忽略用戶中止(真);for( $i = 0; $i <100; $i++){echo "<script type="text/javascript">parent.document.getElementById('foo').innerHTML += 'Line $i<br/>';</script>";回聲 str_repeat('', 2048);沖洗();ob_flush();睡眠(1);fwrite( $fp, "$i
                ");}fclose($fp);

                ma??in.html

                <頭><script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript" charset="utf-8"></script><style type="text/css" media="screen">.msg{ 背景:#aaa;填充:.2em;邊框底部:1px #000 實心}.new{ 背景色:#3B9957;}.error{ 背景色:#992E36;}</風格><身體><iframe id="loadarea" width="1024px" height="768px"></iframe><br/><腳本>功能助手(){document.getElementById('loadarea').src = 'test_process.php';}函數殺死(){document.getElementById('loadarea').src = '';}<input type="button" onclick="helper()" value="Start"><input type="button" onclick="kill()" value="停止"><div id="foo"></div>

                解決方案

                我認為您將 ob_flush()flush() 混淆了.ob_start()ob_flush() 處理捕獲所有輸出的 PHP 內部輸出緩沖區,flush() 是刷新 code>STDOUT 就像在其他編程語言中一樣.

                示例:

                您的輸出不會打印,因為您的網絡服務器可能會緩沖內容.嘗試關閉壓縮和輸出緩沖:

                @apache_setenv('no-gzip', 1);@ini_set('zlib.output_compression', 0);@ini_set('implicit_flush', 1);

                還請記住,Safari 和 Internet Explorer 有一個內部 1K 緩沖區.因此,您需要添加 1 KB 的填充數據(如空格),以使它們呈現.

                編輯 2:你的實現被破壞了.您想使用 ajax 輪詢您的數據.在客戶端使用 jQuery:

                0%

                <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"><script type="text/javascript">函數 doPoll(){$.post('script-that-returns-stuff.php', function(data) {$("#counter").html(數據);設置超時(doPoll,5000);});}doPoll();

                然后在 script-that-returns-stuff.php 中:

                Could someone please save these 2 files and run them and tell me why I get the error " ob_flush() [ref.outcontrol]: failed to flush buffer. No buffer to flush". I tried googling around and it says that I have to use ob_start(); but when I do then it doesn't print out line by line, but rather returns the whole object from the FOR loop when it has completed. I'm kinda new to PHP so I'm not sure where else to look..

                test_process.php

                // This script will write numbers from 1 to 100 into file
                // And sends continuously info to user
                $fp = fopen( '/tmp/output.txt', 'w') or die('Failed to open');
                set_time_limit( 120);
                ignore_user_abort(true);
                
                for( $i = 0; $i < 100; $i++){
                    echo "<script type="text/javascript">parent.document.getElementById( 'foo').innerHTML += 'Line $i<br />';</script>";
                    echo str_repeat( ' ', 2048);
                    flush();
                    ob_flush();
                    sleep(1);
                    fwrite( $fp, "$i
                ");
                }
                
                fclose( $fp);
                

                main.html

                <html>
                    <head>
                        <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript" charset="utf-8"></script>
                
                        <style type="text/css" media="screen">
                            .msg{ background:#aaa;padding:.2em; border-bottom:1px #000 solid}
                            .new{ background-color:#3B9957;}
                            .error{ background-color:#992E36;}
                        </style>
                
                    </head>
                    <body>
                
                        <iframe id="loadarea" width="1024px" height="768px"></iframe><br />
                        <script>
                            function helper() {
                                document.getElementById('loadarea').src = 'test_process.php';
                            }
                            function kill() {
                                document.getElementById('loadarea').src = '';
                            }
                        </script>
                
                        <input type="button" onclick="helper()" value="Start">
                        <input type="button" onclick="kill()" value="Stop">
                        <div id="foo"></div>
                
                
                </body>
                </html>
                

                解決方案

                I think you are confusing ob_flush() with flush(). While ob_start() and ob_flush() handles a PHP internal output buffer that catches all outputs, flush() is the normal function that flushes STDOUT like in other programming languages.

                Example:

                <?php
                ob_start();
                echo "Foobar
                Foobar
                Foobar
                ";
                // Nothing printed yet
                ob_flush(); // Now it is printed.
                
                echo "Foobar
                "; // Printed directly, because contains a line ending.
                
                echo "Foobar"; // Not printed, because normally buffers are flushed on line endings
                flush();  // Printed.
                

                EDIT:

                Your output is not printed, because your webserver may buffer the contents. Try to turn off compression and output buffering:

                @apache_setenv('no-gzip', 1);
                @ini_set('zlib.output_compression', 0);
                @ini_set('implicit_flush', 1);
                

                Please also keep in mind, that Safari and Internet Explorer have an internal 1K buffer. So you need to add 1 KB of padding data (like spaces), to make them render.

                EDIT 2: Your implementation is broken. You want to poll your data with ajax. Use jQuery on the client side:

                <div id="counter">0%</div>
                <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js">
                <script type="text/javascript">
                function doPoll(){
                    $.post('script-that-returns-stuff.php', function(data) {
                        $("#counter").html(data);
                        setTimeout(doPoll,5000);
                    });
                }
                doPoll();
                </script>
                

                Then in script-that-returns-stuff.php:

                <?php
                $file = explode("
                ", file_get_contents("/tmp/output.txt"));
                $last_line = $file[count($file)-1];
                echo $last_line."%";
                

                這篇關于PHP 錯誤:ob_flush() [ref.outcontrol]:未能刷新緩沖區.沒有緩沖區可以刷新的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                MySQLi prepared statement amp; foreach loop(MySQLi準備好的語句amp;foreach 循環)
                Is mysqli_insert_id() gets record from whole server or from same user?(mysqli_insert_id() 是從整個服務器還是從同一用戶獲取記錄?)
                PHP MySQLi doesn#39;t recognize login info(PHP MySQLi 無法識別登錄信息)
                mysqli_select_db() expects exactly 2 parameters(mysqli_select_db() 需要 2 個參數)
                Php mysql pdo query: fill up variable with query result(Php mysql pdo 查詢:用查詢結果填充變量)
                MySQLI 28000/1045 Access denied for user #39;root#39;@#39;localhost#39;(MySQLI 28000/1045 用戶“root@“localhost的訪問被拒絕)

                  <small id='cPtmL'></small><noframes id='cPtmL'>

                    <bdo id='cPtmL'></bdo><ul id='cPtmL'></ul>

                    1. <legend id='cPtmL'><style id='cPtmL'><dir id='cPtmL'><q id='cPtmL'></q></dir></style></legend><tfoot id='cPtmL'></tfoot>

                        • <i id='cPtmL'><tr id='cPtmL'><dt id='cPtmL'><q id='cPtmL'><span id='cPtmL'><b id='cPtmL'><form id='cPtmL'><ins id='cPtmL'></ins><ul id='cPtmL'></ul><sub id='cPtmL'></sub></form><legend id='cPtmL'></legend><bdo id='cPtmL'><pre id='cPtmL'><center id='cPtmL'></center></pre></bdo></b><th id='cPtmL'></th></span></q></dt></tr></i><div class="3vpxlzn" id='cPtmL'><tfoot id='cPtmL'></tfoot><dl id='cPtmL'><fieldset id='cPtmL'></fieldset></dl></div>
                            <tbody id='cPtmL'></tbody>
                        • 主站蜘蛛池模板: 活性氧化铝球|氧化铝干燥剂|分子筛干燥剂|氢氧化铝粉-淄博同心材料有限公司 | 对辊式破碎机-对辊制砂机-双辊-双齿辊破碎机-巩义市裕顺机械制造有限公司 | 三氯异氰尿酸-二氯-三氯-二氯异氰尿酸钠-优氯净-强氯精-消毒片-济南中北_优氯净厂家 | 河南卓美创业科技有限公司-河南卓美防雷公司-防雷接地-防雷工程-重庆避雷针-避雷器-防雷检测-避雷带-避雷针-避雷塔、机房防雷、古建筑防雷等-山西防雷公司 | 首页|专注深圳注册公司,代理记账报税,注册商标代理,工商变更,企业400电话等企业一站式服务-慧用心 | 快速门厂家-快速卷帘门-工业快速门-硬质快速门-西朗门业 | 【星耀裂变】_企微SCRM_任务宝_视频号分销裂变_企业微信裂变增长_私域流量_裂变营销 | 纯水电导率测定仪-万用气体检测仪-低钠测定仪-米沃奇科技(北京)有限公司www.milwaukeeinst.cn 锂辉石检测仪器,水泥成分快速分析仪-湘潭宇科分析仪器有限公司 手术室净化装修-手术室净化工程公司-华锐手术室净化厂家 | 精密模具制造,注塑加工,吹塑和吹瓶加工,EPS泡沫包装生产 - 济南兴田塑胶有限公司 | 深圳市源和塑胶电子有限公司-首页| 沈阳激光机-沈阳喷码机-沈阳光纤激光打标机-沈阳co2激光打标机 | 高效复合碳源-多核碳源生产厂家-污水处理反硝化菌种一长隆科技库巴鲁 | 全自动过滤器_反冲洗过滤器_自清洗过滤器_量子除垢环_量子环除垢_量子除垢 - 安士睿(北京)过滤设备有限公司 | 中式装修设计_全屋定制家具_实木仿古门窗花格厂家-喜迎门 | app开发|app开发公司|小程序开发|物联网开发||北京网站制作|--前潮网络 | 蚂蚁分类信息系统 - PHP同城分类信息系统 - MayiCMS | 集菌仪厂家_全封闭_封闭式_智能智能集菌仪厂家-上海郓曹 | 中空玻璃生产线,玻璃加工设备,全自动封胶线,铝条折弯机,双组份打胶机,丁基胶/卧式/立式全自动涂布机,玻璃设备-山东昌盛数控设备有限公司 | 婚博会2024时间表_婚博会门票领取_婚博会地址-婚博会官网 | PCB设计,PCB抄板,电路板打样,PCBA加工-深圳市宏力捷电子有限公司 | 扫地车厂家-山西洗地机-太原电动扫地车「大同朔州吕梁晋中忻州长治晋城洗地机」山西锦力环保科技有限公司 | 高考志愿规划师_高考规划师_高考培训师_高报师_升学规划师_高考志愿规划师培训认证机构「向阳生涯」 | 旗帜网络笔记-免费领取《旗帜网络笔记》电子书| 温湿度记录纸_圆盘_横河记录纸|霍尼韦尔记录仪-广州汤米斯机电设备有限公司 | 顶空进样器-吹扫捕集仪-热脱附仪-二次热解吸仪-北京华盛谱信仪器 | 意大利Frascold/富士豪压缩机_富士豪半封闭压缩机_富士豪活塞压缩机_富士豪螺杆压缩机 | 焊接减速机箱体,减速机箱体加工-淄博博山泽坤机械厂 | 全自动烧卖机厂家_饺子机_烧麦机价格_小笼汤包机_宁波江北阜欣食品机械有限公司 | 天助网 - 中小企业全网推广平台_生态整合营销知名服务商_天助网采购优选 | 广域铭岛Geega(际嘉)工业互联网平台-以数字科技引领行业跃迁 | 论文查重_免费论文查重_知网学术不端论文查重检测系统入口_论文查重软件 | 小区健身器材_户外健身器材_室外健身器材_公园健身路径-沧州浩然体育器材有限公司 | 沈阳激光机-沈阳喷码机-沈阳光纤激光打标机-沈阳co2激光打标机 | 直线模组_滚珠丝杆滑台_模组滑台厂家_万里疆科技 | 服务器之家 - 专注于服务器技术及软件下载分享 | 必胜高考网_全国高考备考和志愿填报信息平台| 减速机三参数组合探头|TSM803|壁挂式氧化锆分析仪探头-安徽鹏宸电气有限公司 | 流量检测仪-气密性检测装置-密封性试验仪-东莞市奥图自动化科技有限公司 | 丹佛斯变频器-丹佛斯压力开关-变送器-广州市风华机电设备有限公司 | 钢化玻璃膜|手机钢化膜|钢化膜厂家|手机保护膜-【东莞市大象电子科技有限公司】 | 便民信息网_家电维修,家电清洗,开锁换锁,本地家政公司 |