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


PHP zlib_decode函数代码示例

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


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

示例1: decode

 public function decode()
 {
     $this->protocol = $this->getInt();
     $str = zlib_decode($this->get($this->getInt()), 1024 * 1024 * 64);
     //Max 64MB
     $this->setBuffer($str, 0);
     $chainData = json_decode($this->get($this->getLInt()));
     foreach ($chainData->{"chain"} as $chain) {
         $webtoken = $this->decodeToken($chain);
         if (isset($webtoken["extraData"])) {
             if (isset($webtoken["extraData"]["displayName"])) {
                 $this->username = $webtoken["extraData"]["displayName"];
             }
             if (isset($webtoken["extraData"]["identity"])) {
                 $this->clientUUID = $webtoken["extraData"]["identity"];
             }
             if (isset($webtoken["identityPublicKey"])) {
                 $this->identityPublicKey = $webtoken["identityPublicKey"];
             }
         }
     }
     $skinToken = $this->decodeToken($this->get($this->getLInt()));
     if (isset($skinToken["ClientRandomId"])) {
         $this->clientId = $skinToken["ClientRandomId"];
     }
     if (isset($skinToken["ServerAddress"])) {
         $this->serverAddress = $skinToken["ServerAddress"];
     }
     if (isset($skinToken["SkinData"])) {
         $this->skin = base64_decode($skinToken["SkinData"]);
     }
     if (isset($skinToken["SkinId"])) {
         $this->skinId = $skinToken["SkinId"];
     }
 }
开发者ID:Tinclon,项目名称:PocketMine-MP,代码行数:35,代码来源:LoginPacket.php

示例2: decode

 /**
  * $data    Base64 encoded string
  * 
  * 
  */
 static function decode($encodedData)
 {
     $compressedData = base64_decode($encodedData, true);
     if ($compressedData != false) {
         return zlib_decode($compressedData);
     }
     return false;
 }
开发者ID:citypay,项目名称:php-sdk,代码行数:13,代码来源:ThreeDSecureUtils.php

示例3: decode

 private static function decode($data)
 {
     $decoded = zlib_decode($data);
     if ($decoded === false) {
         throw new \Exception('Cannot decode data: ' . base64_encode($data));
     }
     return $decoded;
 }
开发者ID:ksmaheshkumar,项目名称:PHP-GitScraper,代码行数:8,代码来源:GitScraper.php

示例4: parseData

 /**
  * @param string $data
  * @return TiledMap
  * @throws \Exception
  */
 public function parseData($data)
 {
     $obj = new \SimpleXMLElement($data);
     // <map> attributes
     $map = new TiledMap();
     $this->xmlAttributesToObject($obj, $map);
     // <tileset> + attributes and content
     foreach ($obj->tileset as $tileset) {
         $set = new TiledTileSet();
         $this->xmlAttributesToObject($tileset, $set);
         // <image>
         foreach ($tileset->image as $image) {
             $im = new TiledImage();
             $this->xmlAttributesToObject($image, $im);
             $set->image[] = $im;
         }
         // <tileoffset>
         if (isset($tileset->tileoffset)) {
             $tileoffset = new TiledTileOffset();
             $tileoffset->x = (int) $tileset->tileoffset->attributes()->x;
             $tileoffset->y = (int) $tileset->tileoffset->attributes()->y;
             $set->tileoffset = $tileoffset;
         }
         // <terraintypes>
         if (isset($tileset->terraintypes->terrain)) {
             foreach ($tileset->terraintypes->terrain as $currentTerrain) {
                 $terrain = new TiledTerrain();
                 $this->xmlAttributesToObject($currentTerrain, $terrain);
                 $set->terraintypes[] = $terrain;
             }
         }
         // <tile>
         foreach ($tileset->tile as $currentTile) {
             $tile = new TiledTile();
             $this->xmlAttributesToObject($currentTile, $tile);
             $set->tile[] = $tile;
         }
         $map->tileset[] = $set;
     }
     // <layer> + attributes and content
     foreach ($obj->layer as $currentLayer) {
         $layer = new TiledLayer();
         $this->xmlAttributesToObject($currentLayer, $layer);
         // content
         $layer->encoding = (string) $currentLayer->data->attributes()->encoding;
         $layer->compression = (string) $currentLayer->data->attributes()->compression;
         if ($layer->encoding != 'base64' || $layer->compression != 'zlib') {
             throw new \Exception('Unhandled encoding/compression: ' . $layer->encoding . ', ' . $layer->compression);
         }
         $cdata = base64_decode($currentLayer->data);
         $cdata = zlib_decode($cdata);
         $layer->data = array_values(unpack('V*', $cdata));
         $map->layer[] = $layer;
     }
     return $map;
 }
开发者ID:martinlindhe,项目名称:php-tiled-tmx,代码行数:61,代码来源:Parser.php

示例5: decode

 public function decode($data = '', $length = 0)
 {
     if (!is_scalar($data)) {
         return Error::set('Error', 'valueParameter', '1.(data)');
     }
     if (!is_numeric($length)) {
         return Error::set('Error', 'numericParameter', '2.(length)');
     }
     return zlib_decode($data, $length);
 }
开发者ID:bytemtek,项目名称:znframework,代码行数:10,代码来源:ZLIB.php

示例6: onRun

 public function onRun()
 {
     $old = json_decode(zlib_decode(file_get_contents($this->path)));
     if (is_object($old)) {
         $time = $old->registerTime;
         if ($time !== -1) {
             $this->isReg = false;
         }
     }
     file_put_contents($this->path, zlib_encode($this->contents, ZLIB_ENCODING_DEFLATE));
 }
开发者ID:GoneTone,项目名称:HereAuth,代码行数:11,代码来源:JsonSaveDataTask.php

示例7: loadSkin

 public function loadSkin($human, $fn, $folder = null)
 {
     if ($folder === null) {
         $folder = $this->owner->getDataFolder();
     }
     $bin = file_get_contents($folder . $fn);
     if ($bin === false) {
         return false;
     }
     $human->setSkin(zlib_decode($bin), $slim);
     return true;
 }
开发者ID:0-DevMatthew-0,项目名称:pocketmine-plugins,代码行数:12,代码来源:CmdSkinner.php

示例8: onRun

 public function onRun()
 {
     $db = $this->getMysqli();
     $result = $db->query("SELECT * FROM `{$this->tableName}` WHERE name='{$db->escape_string($this->name)}'");
     $row = $result->fetch_assoc();
     $result->close();
     if (!is_array($row)) {
         $this->setResult(false, false);
         return;
     }
     $row["hash"] = rtrim($row["hash"]);
     $row["skin"] = zlib_decode($row["skin"]);
     $this->setResult($row);
 }
开发者ID:GoneTone,项目名称:HereAuth,代码行数:14,代码来源:MySQLLoadPlayerTask.php

示例9: getlineno

 function getlineno()
 {
     $session = JFactory::getSession();
     $has_zlib = version_compare(PHP_VERSION, '5.4.0', '>=');
     $conf = $session->get('csvimport_config', "", 'flexicontent');
     $conf = unserialize($conf ? $has_zlib ? zlib_decode(base64_decode($conf)) : base64_decode($conf) : "");
     $lineno = $session->get('csvimport_lineno', 999999, 'flexicontent');
     if (!empty($conf)) {
         echo 'success|' . count($conf['contents_parsed']) . '|' . $lineno . '|' . (FLEXI_J30GE ? JSession::getFormToken() : JUtility::getToken());
     } else {
         echo 'fail|0|0';
     }
     jexit();
 }
开发者ID:noxidsoft,项目名称:flexicontent-cck,代码行数:14,代码来源:import.raw.php

示例10: decode

 public function decode()
 {
     parent::decode();
     $this->buffers = [];
     $size = $this->getInt();
     $this->payload = $this->get($size);
     $str = zlib_decode($this->payload, 1024 * 1024 * 64);
     //Max 64MB
     $len = strlen($str);
     $offset = 0;
     while ($offset < $len) {
         $pkLen = Binary::readInt(substr($str, $offset, 4));
         $offset += 4;
         $buf = substr($str, $offset, $pkLen);
         $offset += $pkLen;
         $this->buffers[] = $buf;
     }
     //print_r($this);
 }
开发者ID:nao20010128nao,项目名称:PEPacketAnalyze,代码行数:19,代码来源:BatchPacket.php

示例11: decode_cookie

/**
 * Decode and verify a cookie.
 */
function decode_cookie($cookie, $key, $sep = '.')
{
    $tokens = explode($sep, $cookie);
    $signature = array_pop($tokens);
    $timestamp = array_pop($tokens);
    $value = implode($sep, $tokens);
    $is_compressed = false;
    if (verify_signature($key, $value . $sep . $timestamp, $signature)) {
        if ($value[0] == '.') {
            $value = substr($value, 1);
            $is_compressed = true;
        }
        $value = urlsafe_b64decode($value);
        if ($is_compressed) {
            $value = zlib_decode($value);
        }
        return json_decode($value);
    }
    return null;
}
开发者ID:homeworkprod,项目名称:flask-cookie-decoder,代码行数:23,代码来源:flask-cookie-decoder.php

示例12: decode

 public function decode()
 {
     //$this->username = $this->getString();
     //$this->protocol1 = $this->getInt();
     //$this->protocol2 = $this->getInt();
     /*if($this->protocol1 < Info::CURRENT_PROTOCOL){ //New fields!
     			$this->setBuffer(null, 0); //Skip batch packet handling
     			return;
     		}*/
     $this->protocol = $this->getInt();
     $str = zlib_decode($this->get($this->getInt()), 1024 * 1024 * 64);
     $this->setBuffer($str, 0);
     $chainData = json_decode($this->get($this->getLInt()));
     foreach ($chainData->{"chain"} as $chain) {
         $webtoken = $this->decodeToken($chain);
         if (isset($webtoken["extraData"])) {
             if (isset($webtoken["extraData"]["displayName"])) {
                 $this->username = $webtoken["extraData"]["displayName"];
             }
             if (isset($webtoken["extraData"]["identity"])) {
                 $this->clientUUID = $webtoken["extraData"]["identity"];
             }
             if (isset($webtoken["identityPublicKey"])) {
                 $this->identityPublicKey = $webtoken["identityPublicKey"];
             }
         }
     }
     $skinToken = $this->decodeToken($this->get($this->getLInt()));
     if (isset($skinToken["ClientRandomId"])) {
         $this->clientId = $skinToken["ClientRandomId"];
     }
     if (isset($skinToken["ServerAddress"])) {
         $this->serverAddress = $skinToken["ServerAddress"];
     }
     if (isset($skinToken["SkinData"])) {
         $this->skin = base64_decode($skinToken["SkinData"]);
     }
     if (isset($skinToken["SkinId"])) {
         $this->skinId = $skinToken["SkinId"];
     }
 }
开发者ID:yungtechboy1,项目名称:Genisys,代码行数:41,代码来源:LoginPacket.php

示例13: onRun

 public function onRun()
 {
     if (is_file($this->newPath)) {
         $this->success = Database::RENAME_TARGET_PRESENT;
         return;
     }
     if (!is_file($this->oldPath)) {
         $this->setResult("File didn't exist", false);
         $this->success = Database::RENAME_SOURCE_ABSENT;
         return;
     }
     if (!is_dir($dir = dirname($this->newPath))) {
         mkdir($dir);
     }
     $data = json_decode(zlib_decode(file_get_contents($this->oldPath)));
     $data->multiHash = ["renamed;{$this->oldName}" => $data->passwordHash];
     $data->passwordHash = "{RENAMED}";
     unlink($this->oldPath);
     file_put_contents($this->newPath, zlib_encode(json_encode($data), ZLIB_ENCODING_DEFLATE));
     $this->success = Database::SUCCESS;
 }
开发者ID:PEMapModder,项目名称:HereAuth,代码行数:21,代码来源:JsonRenameTask.php

示例14: onMessage

 public function onMessage(ConnectionInterface $conn, $message)
 {
     $id = $conn->resourceId;
     if ($message == "status") {
         $sql = $this->dbh->query("SELECT `value` FROM `pi` WHERE `key_name` = 'start' OR `key_name` = 'status'");
         $r = $sql->fetchAll(\PDO::FETCH_ASSOC);
         $response = array("start" => $r[0]['value'], "status" => explode(",", $r[1]['value']));
         $this->send($conn, "status", $response);
         $this->checkIfPiEnded();
     } else {
         if ($message == "pi") {
             if ($this->piProcessRunning()) {
                 $this->send($conn, "pi", "running");
             } else {
                 $sql = $this->dbh->query("SELECT `value` FROM `pi` WHERE `key_name` = 'pi'");
                 $pi = zlib_decode($sql->fetchColumn());
                 $pi = "3." . substr($pi, 1);
                 $this->send($conn, "pi", $pi);
             }
         } else {
             if (substr($message, 0, 3) == "run") {
                 if ($GLOBALS['allow_user_to_run']) {
                     if ($this->piProcessRunning()) {
                         $this->sendToAll("running_as_per_user_request");
                     } else {
                         $digits = substr($message, 4);
                         if (is_numeric($digits) && $digits > 5 && $digits <= 1000000) {
                             $this->runPiFindingProcess($digits);
                             $this->sendToAll("running_as_per_user_request");
                         } else {
                             $this->send($conn, "invalid_digits");
                         }
                     }
                 } else {
                     $this->send($conn, "not_allowed");
                 }
             }
         }
     }
 }
开发者ID:subins2000,项目名称:pi,代码行数:40,代码来源:class.pi.php

示例15: decode

 public function decode()
 {
     $this->protocol = $this->getInt();
     if ($this->protocol !== Info::CURRENT_PROTOCOL) {
         return;
         //Do not attempt to decode for non-accepted protocols
     }
     $this->gameEdition = $this->getByte();
     $str = zlib_decode($this->getString(), 1024 * 1024 * 64);
     $this->setBuffer($str, 0);
     $chainData = json_decode($this->get($this->getLInt()));
     foreach ($chainData->{"chain"} as $chain) {
         $webtoken = $this->decodeToken($chain);
         if (isset($webtoken["extraData"])) {
             if (isset($webtoken["extraData"]["displayName"])) {
                 $this->username = $webtoken["extraData"]["displayName"];
             }
             if (isset($webtoken["extraData"]["identity"])) {
                 $this->clientUUID = $webtoken["extraData"]["identity"];
             }
             if (isset($webtoken["identityPublicKey"])) {
                 $this->identityPublicKey = $webtoken["identityPublicKey"];
             }
         }
     }
     $skinToken = $this->decodeToken($this->get($this->getLInt()));
     if (isset($skinToken["ClientRandomId"])) {
         $this->clientId = $skinToken["ClientRandomId"];
     }
     if (isset($skinToken["ServerAddress"])) {
         $this->serverAddress = $skinToken["ServerAddress"];
     }
     if (isset($skinToken["SkinData"])) {
         $this->skin = base64_decode($skinToken["SkinData"]);
     }
     if (isset($skinToken["SkinId"])) {
         $this->skinId = $skinToken["SkinId"];
     }
 }
开发者ID:xxFlare,项目名称:PocketMine-MP,代码行数:39,代码来源:LoginPacket.php


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