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


PHP Debug::exportBytes方法代码示例

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


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

示例1: stdin

 /**
  * Called when new data received
  * @param string New data
  * @return void
  */
 public function stdin($buf)
 {
     Daemon::log(Debug::exportBytes($buf));
     while ($c = array_pop($this->callbacks)) {
         list($cb, $st) = $c;
         $cb(microtime(true) - $st);
     }
 }
开发者ID:J3FF3,项目名称:phpdaemon,代码行数:13,代码来源:PingClient.php

示例2: stdin

 /**
  * Called when new data received
  * @param string New data
  * @return void
  */
 public function stdin($buf)
 {
     $this->buf .= $buf;
     while (($l = $this->gets()) !== FALSE) {
         $e = explode(' ', rtrim($l, "\r\n"));
         if ($e[0] === 'RUN') {
             if (isset($this->appInstance->jobs[$e[1]])) {
                 call_user_func($this->appInstance->jobs[$e[1]][0], $e[0], $e[1], $this->appInstance);
             }
         } elseif ($e[0] === 'DONE') {
             if (isset($this->appInstance->jobs[$e[1]][1])) {
                 call_user_func($this->appInstance->jobs[$e[1]][1], $e[0], $e[1], $this->appInstance);
             }
         } elseif ($e[0] === 'FAILED') {
             if (isset($this->appInstance->jobs[$e[1]][2])) {
                 call_user_func($this->appInstance->jobs[$e[1]][2], $e[0], $e[1], $this->appInstance);
             }
         }
         if ($this->appInstance->config->protologging->value) {
             Daemon::log('Lock client <-- Lock server: ' . Debug::exportBytes(implode(' ', $e)) . "\n");
         }
     }
 }
开发者ID:J3FF3,项目名称:phpdaemon,代码行数:28,代码来源:LockClient.php

示例3: getLV

 public static function getLV(&$p, $l = 1, $nul = false, $lrev = false)
 {
     $s = self::b2i(binarySubstr($p, 0, $l), !!$lrev);
     //Daemon::log('s = '.$s. ' -- '.Debug::exportBytes(binarySubstr($p,0,$l), true));
     $p = binarySubstr($p, $l);
     if ($s == 0) {
         return '';
     }
     $r = '';
     if (strlen($p) < $s) {
         echo "getLV error: buf length (" . strlen($p) . "): " . Debug::exportBytes($p) . ", must be >= string length (" . $s . ")\n";
     } elseif ($nul) {
         if ($p[$s - 1] != "") {
             echo "getLV error: Wrong end of NUL-string (" . Debug::exportBytes($p[$s - 1]) . "), len " . $s . "\n";
         } else {
             $d = $s - 1;
             if ($d < 0) {
                 $d = 0;
             }
             $r = binarySubstr($p, 0, $d);
             $p = binarySubstr($p, $s);
         }
     } else {
         $r = binarySubstr($p, 0, $s);
         $p = binarySubstr($p, $s);
     }
     return $r;
 }
开发者ID:ruslanchek,项目名称:phpdaemon,代码行数:28,代码来源:Binary.php

示例4: read

 /**
  * Read data from the connection's buffer
  * @param integer Connection's ID
  * @param integer Max. number of bytes to read
  * @return string Readed data
  */
 public function read($connId, $n)
 {
     if (!isset($this->buf[$connId])) {
         return FALSE;
     }
     if (isset($this->readEvents[$connId])) {
         if (Daemon::$useSockets) {
             $read = socket_read(Daemon::$process->pool[$connId], $n);
             if ($read === FALSE) {
                 $no = socket_last_error(Daemon::$process->pool[$connId]);
                 if ($no !== 11) {
                     // Resource temporarily unavailable
                     Daemon::log(get_class($this) . '::' . __METHOD__ . ': connId = ' . $connId . '. Socket error. (' . $no . '): ' . socket_strerror($no));
                     $this->onFailureEvent($connId, array());
                 }
             }
         } else {
             $read = fread(Daemon::$process->pool[$connId], $n);
         }
     } else {
         $read = event_buffer_read($this->buf[$connId], $n);
     }
     if ($read === '' || $read === NULL || $read === FALSE) {
         if (Daemon::$config->logreads->value) {
             Daemon::log('read(' . $connId . ',' . $n . ') interrupted.');
         }
         unset(Daemon::$process->readPoolState[$connId]);
         return FALSE;
     }
     if (Daemon::$config->logreads->value) {
         Daemon::log('read(' . $connId . ',' . $n . ',[' . gettype($read) . '-' . ($read === FALSE ? 'false' : strlen($read)) . ':' . Debug::exportBytes($read) . ']).');
     }
     return $read;
 }
开发者ID:ruslanchek,项目名称:phpdaemon,代码行数:40,代码来源:AsyncServer.php

示例5: __construct


//.........这里部分代码省略.........
                     break;
                 } else {
                     if ($elTypes[$i] === Daemon_ConfigParser::T_STRING) {
                         $cfg->raiseError('Unexpected T_CVALUE.');
                     } else {
                         if (!isset($elements[$i])) {
                             $elements[$i] = '';
                         }
                         $elements[$i] .= $c;
                         $elTypes[$i] = Daemon_ConfigParser::T_CVALUE;
                     }
                 }
             }
             foreach ($elTypes as $k => $v) {
                 if (Daemon_ConfigParser::T_CVALUE === $v) {
                     if (ctype_digit($elements[$k])) {
                         $elements[$k] = (int) $elements[$k];
                     } elseif (is_numeric($elements[$k])) {
                         $elements[$k] = (double) $elements[$k];
                     } else {
                         $l = strtolower($elements[$k]);
                         if ($l === 'true' || $l === 'on') {
                             $elements[$k] = true;
                         } elseif ($l === 'false' || $l === 'off') {
                             $elements[$k] = false;
                         } elseif ($l === 'null') {
                             $elements[$k] = null;
                         }
                     }
                 }
             }
             if ($tokenType === 0) {
                 $cfg->raiseError('Expected \';\' or \'{\'');
             } elseif ($tokenType === Daemon_ConfigParser::T_VAR) {
                 $name = str_replace('-', '', strtolower($elements[0]));
                 $scope = $cfg->getCurrentScope();
                 if ($name === 'include') {
                     $path = $elements[1];
                     if (substr($path, 0, 1) !== '/') {
                         $path = 'conf/' . $path;
                     }
                     $files = glob($path);
                     if ($files) {
                         foreach ($files as $fn) {
                             $parser = new Daemon_ConfigParser($fn, $scope, true);
                         }
                     }
                 } elseif (substr(strtolower($elements[0]), 0, 4) === 'mod-') {
                     $cfg->raiseError('Variable started with \'mod-\'. This style is deprecated. You should replace it with block.');
                 } elseif (isset($scope->{$name})) {
                     if ($scope->{$name}->source != 'cmdline') {
                         if (!isset($elements[1])) {
                             $elements[1] = true;
                             $elTypes[1] = Daemon_ConfigParser::T_CVALUE;
                         }
                         if ($elTypes[1] === Daemon_ConfigParser::T_CVALUE && is_string($elements[1])) {
                             $scope->{$name}->setHumanValue($elements[1]);
                         } else {
                             $scope->{$name}->setValue($elements[1]);
                         }
                         $scope->{$name}->source = 'config';
                         $scope->{$name}->revision = $cfg->revision;
                     }
                 } elseif (sizeof($cfg->state) > 1) {
                     $scope->{$name} = new Daemon_ConfigEntry();
                     $scope->{$name}->source = 'config';
                     $scope->{$name}->revision = $cfg->revision;
                     if (!isset($elements[1])) {
                         $elements[1] = true;
                         $elTypes[1] = Daemon_ConfigParser::T_CVALUE;
                     }
                     $scope->{$name}->setValue($elements[1]);
                     $scope->{$name}->setValueType($elTypes[1]);
                 } else {
                     $cfg->raiseError('Unrecognized parameter \'' . $name . '\'');
                 }
             } elseif ($tokenType === Daemon_ConfigParser::T_BLOCK) {
                 $scope = $cfg->getCurrentScope();
                 $sectionName = implode('-', $elements);
                 $sectionName = strtr($sectionName, '-. ', ':::');
                 if (!isset($scope->{$sectionName})) {
                     $scope->{$sectionName} = new Daemon_ConfigSection();
                 }
                 $scope->{$sectionName}->source = 'config';
                 $scope->{$sectionName}->revision = $cfg->revision;
                 $cfg->state[] = array(Daemon_ConfigParser::T_ALL, $scope->{$sectionName});
             }
         } else {
             $cfg->raiseError('Unexpected char \'' . Debug::exportBytes($c) . '\'');
         }
     });
     for (; $cfg->p < $cfg->len; ++$cfg->p) {
         $c = $cfg->getCurrentChar();
         $e = end($this->state);
         $cfg->token($e[0], $c);
     }
     if (!$included) {
         $this->purgeScope($this->result);
     }
 }
开发者ID:ruslanchek,项目名称:phpdaemon,代码行数:101,代码来源:Daemon_ConfigParser.php

示例6: stdin

 /**
  * Called when new data received.
  * @param string New data.
  * @return void
  */
 public function stdin($buf)
 {
     $this->buf .= $buf;
     while (($l = $this->gets()) !== FALSE) {
         $l = rtrim($l, "\r\n");
         $e = explode(' ', $l, 2);
         if ($e[0] === 'acquire') {
             $this->writeln($this->acquireLock($e[1]) . ' ' . $e[1]);
         } elseif ($e[0] === 'acquireWait') {
             $this->writeln($this->acquireLock($e[1], TRUE) . ' ' . $e[1]);
         } elseif ($e[0] === 'done') {
             $this->done($e[1], 'DONE');
         } elseif ($e[0] === 'failed') {
             $this->done($e[1], 'FAILED');
         } elseif ($e[0] === 'quit') {
             $this->finish();
         } elseif ($e[0] !== '') {
             $this->writeln('PROTOCOL_ERROR');
         }
         if ($this->pool->config->protologging->value) {
             Daemon::log('Lock client --> Lock server: ' . Debug::exportBytes(implode(' ', $e)) . "\n");
         }
     }
     if (strpos($this->buf, "ÿôÿý") !== FALSE || strpos($this->buf, "ÿì") !== FALSE) {
         $this->finish();
     }
 }
开发者ID:ruslanchek,项目名称:phpdaemon,代码行数:32,代码来源:LockServer.php

示例7: onEvBufReadEvent

 public function onEvBufReadEvent($evBuf, $arg)
 {
     $connId = $arg[0];
     Debug::netEvent(get_class($this) . '::' . __METHOD__ . '(' . $connId . ') invoked. ');
     $this->updateLastContact($connId);
     $data = '';
     while (true) {
         $read = event_buffer_read($evBuf, $this->readPacketSize);
         if ($read === '' || $read === NULL || $read === false) {
             break;
         }
         $data .= $read;
     }
     if ($data) {
         Debug::netEvent(get_class($this) . '::' . __METHOD__ . '(' . $connId . ') stdin(' . Utils::convertSize(strlen($data)) . ') start... ');
         Debug::stdin('Server --> Get Client Data: ' . Debug::exportBytes($data));
         $this->connSocketSessionPool[$connId]->stdin($data);
         Debug::netEvent(get_class($this) . '::' . __METHOD__ . '(' . $connId . ') stdin(' . Utils::convertSize(strlen($data)) . ') end. ');
     }
 }
开发者ID:ansendu,项目名称:ansio,代码行数:20,代码来源:AsyncBase.php

示例8: stdin

 /**
  * Called when new data received
  * @param string New data
  * @return void
  */
 public function stdin($buf)
 {
     $this->buf .= $buf;
     if ($this->appInstance->config->protologging->value) {
         Daemon::log('Server --> Client: ' . Debug::exportBytes($buf) . "\n\n");
     }
     start:
     $this->buflen = strlen($this->buf);
     if ($this->buflen < 5) {
         // Not enough data buffered yet
         return;
     }
     $type = binarySubstr($this->buf, 0, 1);
     list(, $length) = unpack('N', binarySubstr($this->buf, 1, 4));
     $length -= 4;
     if ($this->buflen < 5 + $length) {
         // Not enough data buffered yet
         return;
     }
     $packet = binarySubstr($this->buf, 5, $length);
     $this->buf = binarySubstr($this->buf, 5 + $length);
     if ($type === 'R') {
         // Authentication request
         list(, $authType) = unpack('N', $packet);
         if ($authType === 0) {
             // Successful
             if ($this->appInstance->config->protologging->value) {
                 Daemon::log(__CLASS__ . ': auth. ok.');
             }
             $this->cstate = 4;
             // Auth. ok
             foreach ($this->onConnected as $cb) {
                 call_user_func($cb, $this, TRUE);
             }
         } elseif ($authType === 2) {
             // KerberosV5
             Daemon::log(__CLASS__ . ': Unsupported authentication method: KerberosV5.');
             $this->cstate = 3;
             // Auth. error
             $this->finish();
             // Unsupported,  finish
         } elseif ($authType === 3) {
             // Cleartext
             $this->sendPacket('p', $this->password);
             // Password Message
             $this->cstate = 2;
             // Auth. packet sent
         } elseif ($authType === 4) {
             // Crypt
             $salt = binarySubstr($packet, 4, 2);
             $this->sendPacket('p', crypt($this->password, $salt));
             // Password Message
             $this->cstate = 2;
             // Auth. packet sent
         } elseif ($authType === 5) {
             // MD5
             $salt = binarySubstr($packet, 4, 4);
             $this->sendPacket('p', 'md5' . md5(md5($this->password . $this->user) . $salt));
             // Password Message
             $this->cstate = 2;
             // Auth. packet sent
         } elseif ($authType === 6) {
             // SCM
             Daemon::log(__CLASS__ . ': Unsupported authentication method: SCM.');
             $this->cstate = 3;
             // Auth. error
             $this->finish();
             // Unsupported,  finish
         } elseif ($authType == 9) {
             // GSS
             Daemon::log(__CLASS__ . ': Unsupported authentication method: GSS.');
             $this->cstate = 3;
             // Auth. error
             $this->finish();
             // Unsupported,  finish
         }
     } elseif ($type === 'T') {
         // Row Description
         list(, $numfields) = unpack('n', binarySubstr($packet, 0, 2));
         $p = 2;
         for ($i = 0; $i < $numfields; ++$i) {
             list($name) = $this->decodeNULstrings($packet, 1, $p);
             $field = unpack('NtableOID/nattrNo/NdataType/ndataTypeSize/NtypeMod/nformat', binarySubstr($packet, $p, 18));
             $p += 18;
             $field['name'] = $name;
             $this->resultFields[] = $field;
         }
     } elseif ($type === 'D') {
         // Data Row
         list(, $numfields) = unpack('n', binarySubstr($packet, 0, 2));
         $p = 2;
         $row = array();
         for ($i = 0; $i < $numfields; ++$i) {
             list(, $length) = unpack('N', binarySubstr($packet, $p, 4));
             $p += 4;
//.........这里部分代码省略.........
开发者ID:J3FF3,项目名称:phpdaemon,代码行数:101,代码来源:PostgreSQLClient.php

示例9: stdin

 /**
  * Called when new data received
  * @param string New data
  * @return void
  */
 public function stdin($buf)
 {
     $this->buf .= $buf;
     if ($this->appInstance->config->protologging->value) {
         Daemon::log('Server --> Client: ' . Debug::exportBytes($buf) . "\n\n");
     }
     start:
     $this->buflen = strlen($this->buf);
     if (($packet = $this->getPacketHeader()) === FALSE) {
         return;
     }
     $this->seq = $packet[1] + 1;
     if ($this->cstate === 0) {
         if ($this->buflen < 4 + $packet[0]) {
             // not whole packet yet
             return;
         }
         $this->cstate = 1;
         $p = 4;
         $this->protover = ord(binarySubstr($this->buf, $p++, 1));
         $this->serverver = '';
         while ($p < $this->buflen) {
             $c = binarySubstr($this->buf, $p++, 1);
             if ($c === "") {
                 break;
             }
             $this->serverver .= $c;
         }
         $this->threadId = $this->bytes2int(binarySubstr($this->buf, $p, 4));
         $p += 4;
         $this->scramble = binarySubstr($this->buf, $p, 8);
         $p += 9;
         $this->serverCaps = $this->bytes2int(binarySubstr($this->buf, $p, 2));
         $p += 2;
         $this->serverLang = ord(binarySubstr($this->buf, $p++, 1));
         $this->serverStatus = $this->bytes2int(binarySubstr($this->buf, $p, 2));
         $p += 2;
         $p += 13;
         $restScramble = binarySubstr($this->buf, $p, 12);
         $this->scramble .= $restScramble;
         $p += 13;
         $this->auth();
     } else {
         if ($this->buflen < 4 + $packet[0]) {
             // not whole packet yet
             return;
         }
         $p = 4;
         $fieldCount = ord(binarySubstr($this->buf, $p, 1));
         $p += 1;
         if ($fieldCount === 0xff) {
             // Error packet
             $u = unpack('v', binarySubstr($this->buf, $p, 2));
             $p += 2;
             $this->errno = $u[1];
             $state = binarySubstr($this->buf, $p, 6);
             $p = +6;
             $this->errmsg = binarySubstr($this->buf, $p, $packet[0] + 4 - $p);
             $this->onError();
         } elseif ($fieldCount === 0x0) {
             // OK Packet Empty
             if ($this->cstate === 2) {
                 $this->cstate = 4;
                 if ($this->dbname !== '') {
                     $this->query('USE `' . $this->dbname . '`');
                 }
             }
             $this->affectedRows = $this->parseEncodedBinary($this->buf, $p);
             $this->insertId = $this->parseEncodedBinary($this->buf, $p);
             $u = unpack('v', binarySubstr($this->buf, $p, 2));
             $p += 2;
             $this->serverStatus = $u[1];
             $u = unpack('v', binarySubstr($this->buf, $p, 2));
             $p += 2;
             $this->warnCount = $u[1];
             $this->message = binarySubstr($this->buf, $p, $packet[0] + 4 - $p);
             $this->onResultDone();
         } elseif ($fieldCount === 0xfe) {
             // EOF Packet
             ++$this->instate;
             if ($this->instate === 3) {
                 $this->onResultDone();
             }
         } else {
             // Data packet
             --$p;
             if ($this->instate === 0) {
                 // Result Set Header Packet
                 $extra = $this->parseEncodedBinary($this->buf, $p);
                 ++$this->instate;
             } elseif ($this->instate === 1) {
                 // Field Packet
                 $field = array('catalog' => $this->parseEncodedString($this->buf, $p), 'db' => $this->parseEncodedString($this->buf, $p), 'table' => $this->parseEncodedString($this->buf, $p), 'org_table' => $this->parseEncodedString($this->buf, $p), 'name' => $this->parseEncodedString($this->buf, $p), 'org_name' => $this->parseEncodedString($this->buf, $p));
                 ++$p;
                 // filler
//.........这里部分代码省略.........
开发者ID:J3FF3,项目名称:phpdaemon,代码行数:101,代码来源:MySQLClient.php

示例10: stdin

 public function stdin($buf)
 {
     Debug::debug(Debug::exportBytes($buf));
     $this->buf .= $buf;
     start:
     if ($this->state === 0) {
         while (($l = $this->gets()) !== FALSE) {
             $e = explode(' ', rtrim($l, "\r\n"));
             if ($e[0] == 'VALUE') {
                 $this->key = $e[1];
                 $this->valueFlags = $e[2];
                 $this->valueLength = $e[3];
                 $this->result = '';
                 $this->state = 1;
                 break;
             } elseif ($e[0] == 'STAT') {
                 if ($this->result === NULL) {
                     $this->result = array();
                 }
                 $this->result[$e[1]] = $e[2];
             } elseif ($e[0] === 'STORED' || $e[0] === 'END' || $e[0] === 'DELETED' || $e[0] === 'ERROR' || $e[0] === 'CLIENT_ERROR' || $e[0] === 'SERVER_ERROR') {
                 if ($e[0] !== 'END') {
                     $this->result = FALSE;
                     $this->error = isset($e[1]) ? $e[1] : NULL;
                 }
                 $cb = array_shift($this->callbacks);
                 if ($cb) {
                     call_user_func($cb, $this);
                 }
                 $this->valueSize = 0;
                 $this->result = NULL;
             }
         }
     }
     if ($this->state === 1) {
         if ($this->valueSize < $this->valueLength) {
             $n = $this->valueLength - $this->valueSize;
             $buflen = strlen($this->buf);
             if ($buflen > $n) {
                 $this->result .= binarySubstr($this->buf, 0, $n);
                 $this->buf = binarySubstr($this->buf, $n);
             } else {
                 $this->result .= $this->buf;
                 $n = $buflen;
                 $this->buf = '';
             }
             $this->valueSize += $n;
             if ($this->valueSize >= $this->valueLength) {
                 $this->state = 0;
                 goto start;
             }
         }
     }
 }
开发者ID:ansendu,项目名称:ansio,代码行数:54,代码来源:MemcacheClient.php

示例11: stdin

 /**
  * Called when new data received.
  * @param string New data.
  * @return void
  */
 public function stdin($buf)
 {
     // from mysqld to client.
     if ($this->appInstance->config->protologging->value) {
         Daemon::log('MysqlProxy: Server --> Client: ' . Debug::exportBytes($buf) . "\n\n");
     }
     $this->downstream->write($buf);
 }
开发者ID:J3FF3,项目名称:phpdaemon,代码行数:13,代码来源:MySQLProxy.php


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