navy92f 发表于 2010-4-19 16:30:13

CI怎样实现输出缓存控制?

本帖最后由 navy92f 于 2010-4-20 17:01 编辑

我终于可以发言了 一直有很多问题
其中就是关于Ci的输出缓存控制(就是说output buffer/flusher 之类) 请问CI是怎样实现的?
我感觉ob这一块比较难懂 控制器里echo 和view里面echo语句 有什么区分?
这块好像在Loader类里面 我看了一点 但是没懂:L
我希望能在源码上理解这个过程。
望高手指导:)
Loader.php 690
----------------------------------------------------------------
/*
               * Flush the buffer... or buff the flusher?
               *
               * In order to permit views to be nested within
               * other views, we need to flush the content back out whenever
               * we are beyond the first level of output buffering so that
               * it can be seen and included properly by the first included
               * template and any subsequent ones. Oy!
               *
               */       
                if (ob_get_level() > $this->_ci_ob_level + 1)
                {
                        ob_end_flush();
                }
                else
                {
                        // PHP 4 requires that we use a global
                        global $OUT;
                        $OUT->append_output(ob_get_contents());
                        @ob_end_clean();
                }
页: [1]
查看完整版本: CI怎样实现输出缓存控制?