快捷搜索:   服务器  安全  linux 安全  MYSQL  dedecms

一个强大的PHP缓存类(11)


                }
                else{
                    $this->addLog('reading APP key:'.$var);             
                    return $this->application[md5($var)];//return value
                }
            }
        }
    //////////End Cache for APP variables///////////////////
    
    ////DEBUG
    //sets debug on or off
        public function setDebug($state){
            $this->debug=(bool) $state;
        }
        
        public function returnDebug($type='HTML'){
            if ($this->debug){
                switch($type){
                    case 'array':
                        return $this->log;
                    break;
                    case 'HTML'://returns debug as HTML
                        echo '<ol>';
                        foreach($this->log as $key=>$value){//loop in the log var
                            echo '<li>'.$value.'</li>';
                        }
                        echo '</ol>';
                    break;
                }  
            }
            else return false; 
        }
        
        //add debug log
        public function addLog($value){
            if ($this->debug){//only if debug enabled
                array_push($this->log, round((microtime(true) - $this->start_time),5).'s - '. $value); 
            }
        }
}
?>
 

顶(0)
踩(0)

您可能还会对下面的文章感兴趣:

最新评论