当前位置: 首页>>代码示例>>PHP>>正文


PHP Debugger类代码示例

本文整理汇总了PHP中Debugger的典型用法代码示例。如果您正苦于以下问题:PHP Debugger类的具体用法?PHP Debugger怎么用?PHP Debugger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Debugger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: validate

    public function validate()
    {/*{{{*/
        $debugger = new Debugger();
        $memcacheTime = $msg = '';
        foreach ($this->hosts as $memcache)
        {
            $start = $debugger->getTimeStamp();
            $m = new Memcached;
            $m->addServer($memcache['host'], $memcache['port']);
			$m->set('monitortest', 'haha', 10);
			$res = $m->get('monitortest');
            $end = $debugger->getTimeStamp();
            $diff = $debugger->timeDiff($start, $end);
            $key = $memcache['host'].':'.$memcache['port'];
            if (false == $res || 'haha' != $res)
            {
                $msg .= $key.'memcacheʧЧ,';
            }
            if ($this->maxConnectTime < $diff)
            {
                $msg .= $key.'Á¬½Ó'.substr($diff, 0, 6).'ms,';
            }
            $memcacheTime .= "$diff ";
        }
        error_log(date('Y-m-d H:i:s').' '.rtrim($memcacheTime)."\n", 3, '/tmp/memcache_time.log');
        if ($msg)
        {
            error_log(date('Y-m-d H:i:s').' '.$msg."\n", 3, '/tmp/memcache.log');
        }
        return $msg;
    }/*}}}*/
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:31,代码来源:memcache.php

示例2: setDebugEnabled

 /**
  * @param bool|false $flag
  * @return $this
  */
 public function setDebugEnabled($flag = false)
 {
     if (!$this->_debugger) {
         //只有在debug开启时才实例化debugger,并且不能置于构造方法中,否则形成死循环
         $this->_debugger = Debugger::getInstance();
     }
     $this->_debugger->setEnabled($flag);
     return $this;
 }
开发者ID:zhxia,项目名称:nspf,代码行数:13,代码来源:Application.php

示例3: add

 /**
  * add method
  *
  * @return void
  */
 public function add()
 {
     if ($this->request->is('post')) {
         //Check to see if the user has selected a file
         $this->Upload->set($this->request->data);
         if ($this->Upload->validates()) {
             //http://milesj.me/code/cakephp/uploader
             $this->Uploader = new Uploader(array('tempDir' => TMP, 'baseDir' => WWW_ROOT, 'uploadDir' => 'files/uploads/' . $userFolder . '/', 'maxNameLength' => 200));
             if ($data = $this->Uploader->upload('fileName')) {
                 // Upload successful, do whatever
                 //debug($data);
                 //Add pertinent data to the array
                 $this->request->data['Upload'] = $data;
                 $this->request->data['Upload']['active'] = 1;
                 //Disable until the user pays
                 $this->request->data['Upload']['user_id'] = $this->Upload->User->getLastInsertID();
                 //$this->request->data['Upload']['caption'] = $this->request->data['Upload']['custom_name'];
                 $this->Upload->create();
                 if ($this->Upload->save($this->request->data)) {
                     //Set the upload id
                     $this->request->data['Upload']['id'] = $this->Upload->getLastInsertID();
                 } else {
                     $this->Session->setFlash(__('Bummer :( Your file could NOT be uploaded.'));
                     $this->log('The file could not be uploaded.', 'upload_debug');
                     Debugger::log($data);
                 }
             }
         }
     }
     $works = $this->Upload->Work->find('list');
     $this->set(compact('works'));
 }
开发者ID:robksawyer,项目名称:article,代码行数:37,代码来源:UploadsController.php

示例4: openChartWithId

 static function openChartWithId($_cid)
 {
     require_once '../config.php';
     require_once 'charts/PieChart.php';
     require_once 'charts/Column.php';
     global $db;
     $sql = "select * from colfusion_charts where id = " . $_cid;
     $rst = $db->get_result($sql);
     $obj = $rst[0];
     $datainfo = str_replace('\\"', '"', $obj->datainfo);
     include_once 'Debug/Debugger.php';
     Debugger::var_dump_value('cid', $_cid, null);
     if ($obj->type == "pie") {
         return new PieChart($_cid, $obj->name, $obj->canvas, $obj->type, $obj->left, $obj->top, $obj->depth, $obj->height, $obj->width, $obj->datainfo, $obj->note);
     }
     if ($obj->type == "column") {
         return new ColumnChart($_cid, $obj->name, $obj->canvas, $obj->type, $obj->left, $obj->top, $obj->depth, $obj->height, $obj->width, $obj->datainfo, $obj->note);
     }
     if ($_type == "table") {
         return new TableChart($_cid, $obj->name, $obj->canvas, $obj->type, $obj->left, $obj->top, $obj->depth, $obj->height, $obj->width, $obj->datainfo, $obj->note);
     }
     if ($_type == "combo") {
         return new ComboChart($_cid, $obj->name, $obj->canvas, $obj->type, $obj->left, $obj->top, $obj->depth, $obj->height, $obj->width, $obj->datainfo, $obj->note);
     }
     if ($_type == "map") {
         return new MapChart($_cid, $obj->name, $obj->canvas, $obj->type, $obj->left, $obj->top, $obj->depth, $obj->height, $obj->width, $obj->datainfo, $obj->note);
     }
     if ($_type == "motion") {
         return new MotionChart($_cid, $obj->name, $obj->canvas, $obj->type, $obj->left, $obj->top, $obj->depth, $obj->height, $obj->width, $obj->datainfo, $obj->note);
     }
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:31,代码来源:ChartFactory.php

示例5: getDebugger

 public function getDebugger(array $config = [])
 {
     if (null === $this->debugger) {
         $this->debugger = Debugger::get(get_class($this), $config);
     }
     return $this->debugger;
 }
开发者ID:mariuslundgard,项目名称:php-debug,代码行数:7,代码来源:DebuggableTrait.php

示例6: main

 public function main()
 {
     $aUser = $this->User->find('all');
     foreach ($aUser as $user) {
         $currTime = time();
         $lastTime = strtotime(Hash::get($user, 'User.last_update'));
         //TODO дата с нынешней до last_update
         //если last_update давнее 12 часов, то брать последние 12 часов
         $id = $user['User']['id'];
         $date1 = $lastTime > $currTime - 43200 ? date("Y-m-d H:i:s", $lastTime) : date("Y-m-d H:00:00", $currTime - 43200);
         $date2 = date("Y-m-d H:i:s");
         $data = $this->User->getTimeline($id, $date1, $date2, 0, true);
         //$this->set('data', $data);
         //$this->set('timeFrom', strtotime($date1));
         //$this->set('timeTo', strtotime($date2));
         if (count($data['events'])) {
             Debugger::dump($user['User']['id'] . ' ' . $user['User']['full_name'] . '     from: ' . $date1 . '     to: ' . $date2);
             //Debugger::dump($data['events']);
             /*
             $Email = new CakeEmail('postmark');
             $Email->template('updates_mailer', 'mail')->viewVars( array('data' => $data, 'timeFrom' => strtotime($date1), 'timeTo' => strtotime($date2), 'userID' => $user['User']['id']))
             	->to(Hash::get($user, 'User.username'))
             	->subject('Last updates on Konstruktor.com')
             	->send();
             */
         }
     }
 }
开发者ID:nilBora,项目名称:konstruktor,代码行数:28,代码来源:MailerShell.php

示例7: actionCallback

 public function actionCallback($oauth_token)
 {
     try {
         $login_secret = $this->getSession('oauth')->login_secret;
         if (!$oauth_token) {
             echo "Error! There is no OAuth token!";
             exit;
         }
         if (!$login_secret) {
             echo "Error! There is no OAuth secret!";
             exit;
         }
         $this->oauth->enableDebug();
         $this->oauth->setToken($oauth_token, $login_secret);
         $access_token_info = $this->oauth->getAccessToken(self::ACCESS_TOKEN_URL);
         $this->getSession('oauth')->login_secret = false;
         $this->getSession('oauth')->token = $access_token_info['oauth_token'];
         $this->getSession('oauth')->secret = $access_token_info['oauth_token_secret'];
         $this->getUserDetailsAndLoginUser();
     } catch (OAuthException $E) {
         Debugger::log($E);
         //zalogujeme for sichr
         echo "OAuth login failed. Please, contact administrator.";
         $this->terminate();
     }
 }
开发者ID:osmcz,项目名称:website,代码行数:26,代码来源:OauthPresenter.php

示例8: detect

 /**
  * Detect available adapter
  * @return string
  */
 private static function detect()
 {
     static $autoDetected = null;
     if ($autoDetected) {
         return $autoDetected;
     }
     if (!Debugger::isCachesEnabled()) {
         Debugger::addLine('Caching disabled by Debug Mode settings');
         return self::INST_NONE;
     }
     if (Cache\APCu::isAvailable()) {
         Debugger::addLine('Auto-detected cache type: APCu');
         return $autoDetected = self::INST_APCU;
     }
     if (Cache\XCache::isAvailable()) {
         Debugger::addLine('Auto-detected cache type: XCache');
         return $autoDetected = self::INST_XCACHE;
     } elseif (Cache\MemCached::isAvailable()) {
         Debugger::addLine('Auto-detected cache type: MemCached');
         return $autoDetected = self::INST_MEMCACHED;
     } elseif (Cache\MemCache::isAvailable()) {
         Debugger::addLine('Auto-detected cache type: Memcache');
         return $autoDetected = self::INST_MEMCACHE;
         //        } elseif (Cache\SharedMemory::isAvailable()) {
         //            Debugger::getInstance()->addLine('Auto-detected cache type: Shared Memory');
         //            return $autoDetected = self::INST_SHAREDMEM;
     }
     Debugger::addLine('No cache detected');
     return $autoDetected = self::INST_NONE;
 }
开发者ID:difra-org,项目名称:difra,代码行数:34,代码来源:Cache.php

示例9: beforeRenderFile

 /**
  * Sets a timer point before rendering a file.
  *
  * @param string $viewFile The view being rendered
  */
 public function beforeRenderFile($viewFile)
 {
     if ($this->_renderComplete) {
         return;
     }
     DebugTimer::start('render_' . basename($viewFile), __d('debug_kit', 'Rendering %s', Debugger::trimPath($viewFile)));
 }
开发者ID:basantk,项目名称:cakephp-user-login-basic-2.x,代码行数:12,代码来源:DebugTimerHelper.php

示例10: activate

 function activate()
 {
     $setup = Config::get('RPC');
     $class = URL::getPathPart($setup['class']);
     $method = URL::getPathPart($setup['method']);
     list($action, $type) = explode('.', URL::getPathPart($setup['action']), 2);
     $path = $setup["path"] . "/" . $class . "/" . ucwords($method) . ucwords($action) . "Controller";
     if (file_exists(Loader::getPath("controller", $path))) {
         Debugger::log("CONTROLLER: <span style=\"color: #990000\">" . ucwords($method) . ucwords($action) . "Controller</span>");
         $controller = Loader::loadNew("controller", $path);
         $controller->activate();
         if (is_callable(array($controller, $type))) {
             echo $controller->{$type}();
         }
         return;
     }
     $controller_class = ucwords($class) . ucwords($method) . ucwords($action) . "Controller";
     Debugger::log("CONTROLLER: <span style=\"color: #990000\">{$controller_class}</span>");
     if (file_exists(Loader::getPath("controller", "{$setup['path']}/{$controller_class}"))) {
         $controller = Loader::loadNew("controller", "{$setup['path']}/{$controller_class}");
         $controller->activate();
     } else {
         Loader::load("utility", "Server");
         $ip = Server::getIP();
         $self = Server::getSelf();
         Debugger::log("Possible RPC Injection: RPC call to non-existent controller at path {$setup["path"]}/{$controller_class} {$ip} {$self}");
         error_log("Possible RPC Injection: RPC call to non-existent controller at path {$setup['path']}/{$controller_class} {$ip} {$self}");
     }
 }
开发者ID:htmlgraphic,项目名称:HTMLgraphic-MVC,代码行数:29,代码来源:RpcController.class.inc.php

示例11: getInstance

 /**
  * 
  * singletone pattern
  * @param array
  * @return Debugger instance  
  */
 public static function getInstance(array $params = array())
 {
     if (!self::$instance) {
         self::$instance = new self($params);
     }
     return self::$instance;
 }
开发者ID:ntcnhjdobr,项目名称:simpleSite,代码行数:13,代码来源:Debugger.php

示例12: Resize

 public function Resize($image, $newWidth, $targetName)
 {
     if (!file_exists(PUBLIC_ROOT . $image)) {
         $image = '/assets/images/not-found.gif';
     }
     $imgInfo = getimagesize(PUBLIC_ROOT . $image);
     $oldWidth = $imgInfo[0];
     $oldHeight = $imgInfo[1];
     $changeRatio = $oldWidth / $newWidth;
     $newHeight = round($oldHeight / $changeRatio);
     $newImage = imagecreatetruecolor($newWidth, $newHeight);
     $source = $this->load(PUBLIC_ROOT . $image);
     if ($this->imageType == IMAGETYPE_PNG) {
         imagealphablending($newImage, false);
         imagesavealpha($newImage, true);
         $transparent = imagecolorallocatealpha($newImage, 255, 255, 255, 127);
         imagefilledrectangle($newImage, 0, 0, $newWidth, $newHeight, $transparent);
     }
     imagecopyresampled($newImage, $this->image, 0, 0, 0, 0, $newWidth, $newHeight, $oldWidth, $oldHeight);
     header('Content-Type: image/jpeg');
     imagejpeg($newImage, $targetName, 100);
     Debugger::debug($targetName, 'TARGET');
     //$this->save($targetName);
     $this->image = $newImage;
     imagedestroy($newImage);
 }
开发者ID:lenlyle1,项目名称:lightupdating,代码行数:26,代码来源:Resize.php

示例13: dump

/**
 * Debugger::dump shortcut.
 */
function dump($var)
{
    foreach (func_get_args() as $arg) {
        Debugger::dump($arg);
    }
    return $var;
}
开发者ID:riskatlas,项目名称:micka,代码行数:10,代码来源:shortcuts.php

示例14: GetInstance

 public static function GetInstance()
 {
     if (self::$instance == null) {
         self::$instance = new Debugger();
     }
     return self::$instance;
 }
开发者ID:jmangarret,项目名称:vtigercrm,代码行数:7,代码来源:Debugger.class.php

示例15: start

 /**
  * Start an benchmarking timer.
  *
  * @param string $name The name of the timer to start.
  * @param string $message A message for your timer
  * @return bool Always true
  */
 public static function start($name = null, $message = null)
 {
     $start = microtime(true);
     if (!$name) {
         $named = false;
         $calledFrom = debug_backtrace();
         $name = Debugger::trimpath($calledFrom[0]['file']) . ' line ' . $calledFrom[0]['line'];
     } else {
         $named = true;
     }
     if (!$message) {
         $message = $name;
     }
     $_name = $name;
     $i = 1;
     while (isset(self::$_timers[$name])) {
         $i++;
         $name = $_name . ' #' . $i;
     }
     if ($i > 1) {
         $message .= ' #' . $i;
     }
     self::$_timers[$name] = array('start' => $start, 'message' => $message, 'named' => $named);
     return true;
 }
开发者ID:tetsuo111,项目名称:main_cakephp_app,代码行数:32,代码来源:DebugTimer.php


注:本文中的Debugger类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。