當前位置: 首頁>>代碼示例>>PHP>>正文


PHP debug::add方法代碼示例

本文整理匯總了PHP中debug::add方法的典型用法代碼示例。如果您正苦於以下問題:PHP debug::add方法的具體用法?PHP debug::add怎麽用?PHP debug::add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在debug的用法示例。


在下文中一共展示了debug::add方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: display

 /**
  * 引用模板
  * @param $template  模板
  * @param $cacheTime 是否使用靜態緩存,等於0時不使用,大於0時為緩存時間
  * @param $cacheKey  靜態緩存KEY
  */
 public function display($template, $cacheTime = false, $cacheKey = false)
 {
     $path['template_c'] = $this->get_path($template, 'view_c');
     $path['template'] = $this->get_path($template);
     //當緩存時間未設置時,將自動獲取配置中的緩存時間
     $cache = $cacheTime ? intval($cacheTime) : Config::template('view_cache_time');
     $kVar = empty($cacheKey) ? null : $cacheKey;
     if (file_exists($path['template'])) {
         //如果已編譯模板的不存在或者模板修改時間大於已編譯模板的時間將重新編譯
         if (!file_exists($path['template_c']) || filemtime($path['template']) > filemtime($path['template_c'])) {
             $this->write($path['template_c'], $this->template_parse(file_get_contents($path['template'])));
         }
         if ($cache > 0 && Config::template('view_cache')) {
             if (!Cache::is_cache($this->get_temp_name($template, $cacheKey), Config::template('view_cache_dir'))) {
                 self::cache_compile($path['template_c'], $cacheKey);
                 debug::add('寫入緩存\'<strong>' . $template . $kVar . '</strong>\'緩存時間:' . $cache . '秒。');
             } elseif (Cache::time($this->get_temp_name($template, $cacheKey), Config::config('view_cache_dir')) + $cache > time() && filemtime($path['template']) < Cache::time($this->get_temp_name($template, $cacheKey), Config::config('view_cache_dir'))) {
                 echo Cache::get($this->get_temp_name($template, $cacheKey), Config::config('view_cache_dir'));
                 debug::add('讀取緩存\'<strong>' . $template . '[' . $kVar . ']' . '</strong>緩存時間:' . $cache . '秒。');
             } else {
                 self::cache_compile($path['template_c'], $cacheKey);
                 debug::add('更新緩存\'<strong>' . $template . '[' . $kVar . ']' . '</strong>緩存時間:' . $cache . '秒。');
             }
         } else {
             foreach ($this->var as $k => $v) {
                 ${$k} = $v;
             }
             include $path['template_c'];
             //echo htmlspecialchars($this->template_parse(file_get_contents($path['template'])));
             debug::add('使用模板\'<strong>' . $template . '</strong>\'未使用緩存。');
         }
     } else {
         debug::add('模板<strong>' . $path['template'] . '</strong>不存在。');
     }
 }
開發者ID:pgfeng,項目名稱:GFPHP,代碼行數:41,代碼來源:template.class.php

示例2: run

 /**
  * 入口方法
  * @param array $config 項目簡單配置
  */
 public static function run($config)
 {
     //初始化設置
     self::init();
     //定義係統常量
     self::define($config);
     //包含框架中的函數庫文件
     require FIREZP_PATH . 'common' . DIRECTORY_SEPARATOR . 'function.inc.php';
     //加載所有配置
     if (file_exists(APP_PATH . 'conf' . DIRECTORY_SEPARATOR . 'confing.inc.php')) {
         $appConfig = (require APP_PATH . 'conf' . DIRECTORY_SEPARATOR . 'confing.inc.php');
         $sysConfig = array('page' => 8);
         //係統配置
         $config = array_merge($sysConfig, $appConfig, $config);
     }
     C($config);
     //係統url
     self::initUrl();
     //設置自動加載類
     spl_autoload_register(array('self', 'autoload'));
     //設置包含目錄(類所在的全部目錄),  PATH_SEPARATOR 分隔符號 Linux(:) Windows(;)
     $include_path = get_include_path();
     //原基目錄
     $include_path .= PATH_SEPARATOR . FIREZP_PATH . "base/";
     //框架中基類所在的目錄
     set_include_path($include_path);
     //調試開始
     debug::debugbegin();
     //項目結構化
     appStruct::make();
     //url解析
     parseUrl::run();
     //安全過濾
     self::safe();
     //開始session
     session_start();
     //實例化控製器
     $controllerFile = APP_PATH . "controller" . DIRECTORY_SEPARATOR . strtolower($_GET["c"]) . "Controller.php";
     define('CONTROLLER', $_GET["c"]);
     define('ACTION', $_GET["a"]);
     if (file_exists($controllerFile)) {
         $controller = $_GET["c"] . "Controller";
         $controllerObj = new $controller();
         $action = $_GET["a"] . "Action";
         if (method_exists($controllerObj, $action)) {
             $controllerObj->{$action}();
         } else {
             debug::add($action . '方法不存在');
         }
     } else {
         debug::add('控製器不存在');
     }
     //輸出調試信息
     if (DEBUG == 1) {
         debug::debugend();
         debug::show();
     }
 }
開發者ID:jeremywong1992,項目名稱:companyBook,代碼行數:62,代碼來源:firezp.php

示例3: dump

function dump()
{
    $args = func_get_args();
    if (count($args) < 1) {
        debug::add('dump函數沒有傳入需要調試的參數');
    } else {
        foreach ($args as $val) {
            echo '<div style="width:100%;text-align:left;padding-left:50px;"><pre>';
            print_r($val);
            echo '</pre></div>';
        }
    }
}
開發者ID:jeremywong1992,項目名稱:companyBook,代碼行數:13,代碼來源:function.inc.php

示例4: replace

 public static function replace($pattern, $replace, $string)
 {
     $error = '';
     $str = @preg_replace($pattern, $replace, $string) | $error;
     echo $error;
     if (debug::active()) {
         $error = error_get_last();
         if (strstr($error['message'], 'preg_replace')) {
             $msg = str_replace('preg_replace() [<a href=\'function.preg-replace\'>function.preg-replace</a>]:', '', $error['message']);
             debug::add($msg . ' in ' . $pattern, 'ERROR');
         }
     }
     return $str;
 }
開發者ID:kelubo,項目名稱:OpenQRM,代碼行數:14,代碼來源:regex.class.php

示例5: init

 /**
  * init attribs
  *
  * @acess protected
  */
 function init()
 {
     parent::init();
     if ($this->disabled === true) {
         $this->_init .= ' disabled="disabled"';
     }
     if ($this->name != '') {
         $this->_init .= ' name="' . $this->name . '"';
     }
     if ($this->tabindex != '') {
         $this->_init .= ' tabindex="' . $this->tabindex . '"';
     }
     if ($this->value != '') {
         $this->_init .= ' value="' . $this->value . '"';
     }
     $this->type = strtolower($this->type);
     switch ($this->type) {
         case 'submit':
         case 'reset':
         case 'button':
             $this->_init .= ' type="' . $this->type . '"';
             break;
         default:
             $this->_init .= ' type="button"';
             if (debug::active()) {
                 debug::add('type ' . $this->type . ' not supported - type set to button', 'ERROR');
             }
             break;
     }
 }
開發者ID:kelubo,項目名稱:OpenQRM,代碼行數:35,代碼來源:htmlobject.class.php

示例6: halt

 public function halt($message = '', $sql = '')
 {
     if (DEBUG == 1) {
         debug::add($message . ": <font color='green'>" . $sql . '</font>');
     } else {
         debug::pause($message . ": <font color='green'>" . $sql . '</font>');
     }
 }
開發者ID:jeremywong1992,項目名稱:companyBook,代碼行數:8,代碼來源:mysql.class.php

示例7: get_htmlobject_object

 function get_htmlobject_object($data)
 {
     if (isset($data['object']) && isset($data['object']['type']) && isset($data['object']['attrib']) && isset($data['object']['attrib']['name'])) {
         // set vars
         $object = strtolower($data['object']['type']);
         $attribs = $data['object']['attrib'];
         $name = $data['object']['attrib']['name'];
         // build object
         switch ($object) {
             case 'htmlobject_input':
             case 'htmlobject_select':
             case 'htmlobject_textarea':
             case 'htmlobject_button':
                 $html = $this->make_htmlobject($object, $attribs);
                 break;
             default:
                 if (debug::active()) {
                     debug::add($object . ' is not supported', 'ERROR');
                 }
                 break;
         }
         // set request
         if (isset($this->request) && count($this->request) > 0) {
             $request = '$this->request' . $this->string_to_index($name);
         }
         // build return
         if (isset($request) && $request != '' && isset($html)) {
             // add request to object
             switch ($object) {
                 case 'htmlobject_input':
                     $html = $this->handle_htmlobject_input($html, $request);
                     break;
                 case 'htmlobject_select':
                     $html = $this->handle_htmlobject_select($html, $request);
                     break;
                 case 'htmlobject_textarea':
                     $html = $this->handle_htmlobject_textarea($html, $request);
                     break;
             }
             return $html;
         } elseif (isset($html)) {
             return $html;
         } else {
             return '';
         }
     }
 }
開發者ID:kelubo,項目名稱:OpenQRM,代碼行數:47,代碼來源:htmlobject.form.class.php

示例8: count

 /**
  * 連貫操作執行的find查詢操作
  * @param string $field
  */
 public function count()
 {
     $this->initSql();
     $sql = "SELECT count(*) as count FROM {$this->pre}{$this->table}  {$this->sql['where']} {$this->sql['group']} {$this->sql['having']} {$this->sql['order']} {$this->sql['limit']}";
     $this->check_query($sql);
     debug::start();
     $re = $this->_execute('fetch_first', $sql);
     debug::end();
     debug::add("{$sql}  [" . debug::spent() . "]", 1);
     if (!empty($re)) {
         return $re['count'];
     }
     return $re;
 }
開發者ID:jeremywong1992,項目名稱:companyBook,代碼行數:18,代碼來源:model.class.php

示例9: filter_request

 function filter_request($arg)
 {
     if (is_string($arg)) {
         $str = '';
         $arg = stripslashes($arg);
         if (is_array($this->request_filter)) {
             foreach ($this->request_filter as $reg) {
                 $arg = regex::replace($reg['pattern'], $reg['replace'], $arg);
             }
             $str = $arg;
         } else {
             debug::add('no filter set - use set_request_filter()', 'NOTICE');
             $str = $arg;
         }
         debug::add($arg . ' return ' . $str);
         return $str;
     } else {
         debug::add($arg . ' is not type string', 'ERROR');
     }
 }
開發者ID:kelubo,項目名稱:OpenQRM,代碼行數:20,代碼來源:htmlobject.http.class.php


注:本文中的debug::add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。