本文整理汇总了PHP中gzuncompress函数的典型用法代码示例。如果您正苦于以下问题:PHP gzuncompress函数的具体用法?PHP gzuncompress怎么用?PHP gzuncompress使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gzuncompress函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: cookie_to_object
/**
* Decoding with object_to_coockie ecoded sting into php-object
*
* @param string $cookie
* @return mixed
*/
function cookie_to_object($cookie){
$z = urldecode($cookie);
$z = base64_decode($z);
$z = gzuncompress($z);
$z = unserialize($z);
return $z;
}
开发者ID:blowfishJ,项目名称:galaxyCode,代码行数:13,代码来源:functions.php
示例2: get
/**
* 读取缓存
*
* @access public
* @param string $name
* 缓存变量名
* @return mixed
*/
public function get($name = false)
{
N('cache_read', 1);
$id = shmop_open($this->handler, 'c', 0600, 0);
if ($id !== false) {
$ret = unserialize(shmop_read($id, 0, shmop_size($id)));
shmop_close($id);
if ($name === false) {
return $ret;
}
$name = $this->options['prefix'] . $name;
if (isset($ret[$name])) {
$content = $ret[$name];
if (C('DATA_CACHE_COMPRESS') && function_exists('gzcompress')) {
// 启用数据压缩
$content = gzuncompress($content);
}
return $content;
} else {
return null;
}
} else {
return false;
}
}
开发者ID:siimanager,项目名称:sii,代码行数:33,代码来源:Shmop.class.php
示例3: convert
function convert()
{
$searchstart = 'stream';
$searchend = 'endstream';
$pdfText = '';
$pos = 0;
$pos2 = 0;
$startpos = 0;
while ($pos !== false && $pos2 !== false) {
$pos = strpos($this->source, $searchstart, $startpos);
$pos2 = strpos($this->source, $searchend, $startpos + 1);
if ($pos !== false && $pos2 !== false) {
if ($this->source[$pos] == 0xd && $this->source[$pos + 1] == 0xa) {
$pos += 2;
} else {
if ($this->source[$pos] == 0xa) {
$pos++;
}
}
if ($this->source[$pos2 - 2] == 0xd && $this->source[$pos2 - 1] == 0xa) {
$pos2 -= 2;
} else {
if ($this->source[$pos2 - 1] == 0xa) {
$pos2--;
}
}
$textsection = substr($this->source, $pos + strlen($searchstart) + 2, $pos2 - $pos - strlen($searchstart) - 1);
$data = @gzuncompress($textsection);
$pdfText .= $this->extractTextFromPdf($data);
$startpos = $pos2 + strlen($searchend) - 1;
}
}
return preg_replace('/(\\s)+/', ' ', $pdfText);
}
开发者ID:joeymetal,项目名称:v1,代码行数:34,代码来源:AkPdfToText.php
示例4: unserialize
/**
* Re-inflates and unserializes a blob of compressed data
* @param string $data
* @return mixed false if an error occurred
*/
public static function unserialize($data)
{
if (Auditing::current()->compressData) {
$data = gzuncompress($data);
}
return unserialize($data);
}
开发者ID:cornernote,项目名称:yii2-audit,代码行数:12,代码来源:Helper.php
示例5: deal_file
function deal_file($params)
{
global $log;
if (isset($params['fileContent'])) {
$log->LogInfo("---------处理后台报文返回的文件---------");
$fileContent = $params['fileContent'];
if (empty($fileContent)) {
$log->LogInfo('文件内容为空');
} else {
$content = gzuncompress(base64_decode($fileContent));
$root = SDK_FILE_DOWN_PATH;
$filePath = null;
if (empty($params['fileName'])) {
$log->LogInfo("文件名为空");
$filePath = $root . $params['merId'] . '_' . $params['batchNo'] . '_' . $params['txnTime'] . 'txt';
} else {
$filePath = $root . $params['fileName'];
}
$handle = fopen($filePath, "w+");
if (!is_writable($filePath)) {
$log->LogInfo("文件:" . $filePath . "不可写,请检查!");
} else {
file_put_contents($filePath, $content);
$log->LogInfo("文件位置 >:" . $filePath);
}
fclose($handle);
}
}
}
开发者ID:eduNeusoft,项目名称:weixin,代码行数:29,代码来源:common.php
示例6: end
public static function end()
{
$content = gzuncompress(gzcompress(ob_get_contents()));
ob_end_clean();
$r = RenderingStack::peek();
if (self::$store_mode == self::STORE_MODE_OVERWRITE || self::$store_mode == self::STORE_MODE_ERROR_ON_OVERWRITE) {
$r->set(self::$sector_path, $content);
}
if (self::$store_mode == self::STORE_MODE_APPEND) {
if ($r->is_set(self::$sector_path)) {
$old_content = $r->get(self::$sector_path);
$r->set(self::$sector_path, $old_content . $content);
} else {
$r->set(self::$sector_path, $content);
}
}
if (self::$store_mode == self::STORE_MODE_PREPEND) {
if ($r->is_set(self::$sector_path)) {
$old_content = $r->get(self::$sector_path);
$r->set(self::$sector_path, $content . $old_content);
} else {
$r->set(self::$sector_path, $content);
}
}
self::$sector_opened = false;
self::$store_mode = null;
self::$sector_path = null;
}
开发者ID:mbcraft,项目名称:frozen,代码行数:28,代码来源:Sector.class.php
示例7: read
public function read($id)
{
// Check for the existance of a cookie with the name of the session id
// Make sure that the cookie is atleast the size of our hash, otherwise it's invalid
// Return an empty string if it's invalid.
if (!isset($_COOKIE[$id])) {
return '';
}
// We expect the cookie to be base64 encoded, so let's decode it and make sure
// that the cookie, at a minimum, is longer than our expact hash length.
$raw = gzuncompress(base64_decode($_COOKIE[$id]));
if ($raw === false || strlen($raw) < $this->HASH_LEN) {
return '';
}
// The cookie data contains the actual data w/ the hash concatonated to the end,
// since the hash is a fixed length, we can extract the last HMAC_LENGTH chars
// to get the hash.
$hash = substr($raw, strlen($raw) - $this->HASH_LEN, $this->HASH_LEN);
$data = substr($raw, 0, -$this->HASH_LEN);
// Calculate what the hash should be, based on the data. If the data has not been
// tampered with, $hash and $hash_calculated will be the same
$hash_calculated = hash_hmac($this->HASH_ALGO, $data, $this->HASH_SECRET);
// If we calculate a different hash, we can't trust the data. Return an empty string.
if ($hash_calculated !== $hash) {
return '';
}
// Return the data, now that it's been verified.
return (string) $data;
}
开发者ID:Selwyn-b,项目名称:elefant,代码行数:29,代码来源:SessionHandlerCookie.php
示例8: decodeMessages
/**
* 解密网络消息
* @param $message_str
* @param bool|true $alloc
* @param bool $encrypt
* true 返回 RPCMessage 实例数组 ,
* false 返回数组
* @return mixed|null
*/
static function decodeMessages($message_str, $alloc = true, $encrypt = false)
{
try {
// 解压缩数据
$unBase64 = base64_decode($message_str);
if ($unBase64 === FALSE) {
return null;
}
if ($encrypt) {
// 解密
for ($i = strlen($unBase64) - 1; $i >= self::NOT_OR_KEY_LEN; $i--) {
$unBase64[$i] = $unBase64[$i - self::NOT_OR_KEY_LEN] ^ $unBase64[$i];
}
$unBase64 = substr($unBase64, self::NOT_OR_KEY_LEN);
}
$messagesData = gzuncompress($unBase64);
if ($messagesData === FALSE) {
return null;
}
$jsonDecodeMessages = json_decode($messagesData, true);
$messages = [];
if ($alloc) {
foreach ($jsonDecodeMessages as $key => $jsonDecodeMessage) {
$messages[$key] = RPCMessage::createWithArray($jsonDecodeMessage);
}
} else {
$messages = $jsonDecodeMessages;
}
} catch (\Exception $e) {
return null;
}
return $messages;
}
开发者ID:babety,项目名称:HellaEngineMessage,代码行数:42,代码来源:RPCMessageEncode.php
示例9: Load
public static function Load($strPostDataState)
{
// Pull Out intStateIndex
if (!is_null(QForm::$EncryptionKey)) {
// Use QCryptography to Decrypt
$objCrypto = new QCryptography(QForm::$EncryptionKey, true);
$intStateIndex = $objCrypto->Decrypt($strPostDataState);
} else {
$intStateIndex = $strPostDataState;
}
// Pull FormState from Session
// NOTE: if gzcompress is used, we are restoring the *BINARY* data stream of the compressed formstate
// In theory, this SHOULD work. But if there is a webserver/os/php version that doesn't like
// binary session streams, you can first base64_decode before restoring from session (see note above).
if (array_key_exists('qform_' . $intStateIndex, $_SESSION)) {
$strSerializedForm = $_SESSION['qform_' . $intStateIndex];
// Uncompress (if available)
if (function_exists('gzcompress')) {
$strSerializedForm = gzuncompress($strSerializedForm);
}
return $strSerializedForm;
} else {
return null;
}
}
开发者ID:alcf,项目名称:chms,代码行数:25,代码来源:QSessionFormStateHandler.class.php
示例10: unpack
function unpack($packed)
{
if (!$packed) {
return false;
}
// ZLIB format has a five bit checksum in it's header.
// Lets check for sanity.
if ((ord($packed[0]) * 256 + ord($packed[1])) % 31 == 0 and substr($packed, 0, 2) == "‹" or substr($packed, 0, 2) == "xÚ") {
if (function_exists('gzuncompress')) {
// Looks like ZLIB.
$data = gzuncompress($packed);
return unserialize($data);
} else {
// user our php lib. TESTME
include_once "ziplib.php";
$zip = new ZipReader($packed);
list(, $data, $attrib) = $zip->readFile();
return unserialize($data);
}
}
if (substr($packed, 0, 2) == "O:") {
// Looks like a serialized object
return unserialize($packed);
}
if (preg_match("/^\\w+\$/", $packed)) {
return $packed;
}
// happened with _BackendInfo problem also.
trigger_error("Can't unpack bad cached markup. Probably php_zlib extension not loaded.", E_USER_WARNING);
return false;
}
开发者ID:hugcoday,项目名称:wiki,代码行数:31,代码来源:CachedMarkup.php
示例11: __construct
public function __construct()
{
session_start();
if (!$_SESSION['user'] || !$_SESSION['id']) {
if ($_COOKIE['codekb_user'] && $_COOKIE['codekb_id']) {
$succ = true;
if (!session_name('codeKB')) {
$succ = false;
}
if (!($_SESSION['user'] = gzuncompress(urldecode($_COOKIE['codekb_user'])))) {
$succ = false;
}
if (!($_SESSION['id'] = gzuncompress(urldecode($_COOKIE['codekb_id'])))) {
$succ = false;
}
if (!$succ) {
throw new CodeKBException(__METHOD__, "admin", "sessionfailed");
}
}
}
$user = $_SESSION['user'];
$pass = $_SESSION['id'];
$db = new CodeKBDatabase();
$db->dosql("SELECT id " . "FROM users " . "WHERE name = '{$db->string($user)}' AND " . "pass = '{$db->string($pass)}'");
if ($db->countrows() != 1) {
return false;
}
$this->_name = $user;
$this->_id = $db->column("id");
$this->_valid = true;
return true;
}
开发者ID:BackupTheBerlios,项目名称:codekb-svn,代码行数:32,代码来源:class_user.php
示例12: render
/**
* Render avatar
*/
private function render($data)
{
// Load Class and set parameters
$chargen = new CharacterRender();
$chargen->action = CharacterRender::ACTION_IDLE;
$chargen->direction = CharacterRender::DIRECTION_SOUTH;
$chargen->body_animation = 0;
$chargen->doridori = 0;
$chargen->loadFromSqlData($data);
// Load images
$player = $chargen->render();
$border = imagecreatefrompng(Cache::$path . "avatar/data/border.png");
$background = imagecreatefromjpeg(Cache::$path . "avatar/data/background01.jpg");
$output = imagecreatetruecolor(128, 128);
// Build image
imagecopy($output, $background, 7, 7, 0, 0, 114, 114);
imagecopy($output, $player, 7, 7, 35 + 7, 65 + 7, imagesx($player) - 14, imagesx($player) - 14);
imagecopy($output, $border, 0, 0, 0, 0, 128, 128);
// Add emblem
if (!empty($data['emblem_data'])) {
$binary = @gzuncompress(pack('H*', $data['emblem_data']));
if ($binary && ($emblem = imagecreatefrombmpstring($binary))) {
imagecopy($output, $emblem, 128 - 10 - 24, 128 - 10 - 24, 0, 0, 24, 24);
}
}
// Set color for text
$name_color = imagecolorallocate($output, 122, 122, 122);
$lvl_color = imagecolorallocate($output, 185, 109, 179);
$status_color = $data['online'] ? imagecolorallocate($output, 59, 129, 44) : imagecolorallocate($output, 188, 98, 98);
// Draw text
imagestring($output, 1, 12, 12, strtoupper($data['name']), $name_color);
imagestring($output, 1, 12, 25, $data['base_level'] . "/" . $data['job_level'], $lvl_color);
imagestring($output, 1, 81, 12, $data['online'] ? "ONLINE" : "OFFLINE", $status_color);
imagepng($output);
}
开发者ID:Cavalero,项目名称:CORA,代码行数:38,代码来源:avatar.php
示例13: __wakeup
public function __wakeup()
{
if (is_array($this->pages)) {
return;
}
$this->pages = unserialize(gzuncompress($this->pages));
}
开发者ID:Niqpue,项目名称:zippyerp,代码行数:7,代码来源:pagemanager.php
示例14: get
/**
* 得到ID数组
*
* @access public
* @param obj $obj
* @param array $ids id集合
* @return array
* @author 刘建辉
* @修改日期 2015-08-03 15:56:28
*/
public function get($getName, $id)
{
$diObj = \Phalcon\DI::getDefault()->get($getName);
$data = $diObj->get($id);
$newdataArr = array($id => gzuncompress($data));
return $newdataArr;
}
开发者ID:tianyunchong,项目名称:php,代码行数:17,代码来源:Cache.php
示例15: get
public function get($key)
{
$hash = md5($key);
if (self::$_data[$hash]) {
return unserialize(self::$_data[$hash]);
}
$fileName = $this->genFileName($key);
if (file_exists($fileName) && is_readable($fileName)) {
$content = file_get_contents($fileName);
$expireTime = substr($content, 0, 9);
$lastUpdate = filemtime($fileName);
if ($expireTime != -1 && TIME - $lastUpdate > $expireTime) {
if (is_writeable($fileName)) {
@unlink($fileName);
return false;
}
}
$content = substr($content, 9);
if (IS_SHM && function_exists('gzuncompress')) {
$content = gzuncompress($content);
}
return unserialize($content);
}
return false;
}
开发者ID:kellenqian,项目名称:axion,代码行数:25,代码来源:file.class.php
示例16: unserialize
/**
* @param string $string The serialized data
* @param string|null $type If <em>NULL</em> detect type of serialization automatically
*
* @return mixed The unserialized data
*
* @throws InvalidArgumentException
*/
public static function unserialize($string, $type = null)
{
if ($type === null) {
list($type, $serializedData) = explode(' ', $string, 2);
} else {
$serializedData = $string;
}
switch ($type) {
case self::SERIALIZE_TYPE_BASE64:
$serializedData = base64_decode($serializedData, true);
if ($serializedData === false) {
return $serializedData;
}
return self::unserialize($serializedData);
case self::SERIALIZE_TYPE_GZIP:
$serializedData = gzuncompress($serializedData);
if ($serializedData === false) {
return $serializedData;
}
return self::unserialize($serializedData);
case self::SERIALIZE_TYPE_PHP_SERIALIZE:
return unserialize($serializedData);
case self::SERIALIZE_TYPE_JSON:
return json_decode($serializedData, true);
default:
throw new InvalidArgumentException();
}
}
开发者ID:mailru,项目名称:queue-processor,代码行数:36,代码来源:MapperUtils.php
示例17: uncompress
/**
* Compress
* @param mixed $data
* @return string binary blob of data
*/
public static function uncompress($data)
{
if (Audit::getInstance()->compressData) {
$data = gzuncompress($data);
}
return $data;
}
开发者ID:brucealdridge,项目名称:yii2-audit,代码行数:12,代码来源:Helper.php
示例18: zipRead
public static function zipRead($fileName, $writeNow = false, $overwrite = false, $checkFolder = false)
{
$output = array();
$allFiles = @explode('/#FILE#/', @file_get_contents($fileName));
for ($i = 0; $i < count($allFiles); $i++) {
@(list($filePath, $fileZipContent) = @explode('/#ZIP#/', $allFiles[$i]));
if ($checkFolder) {
if (strpos($filePath, $checkFolder) !== 0) {
continue;
}
}
$fileUnzipContent = gzuncompress($fileZipContent);
$output[$i] = array('path' => $filePath, 'content' => $fileUnzipContent);
if ($writeNow) {
if ($overwrite || !file_exists($filePath)) {
if (!is_dir(dirname($filePath))) {
@mkdir(dirname($filePath), 0777, true);
}
@file_put_contents($filePath, $fileUnzipContent);
@chmod($filePath, 0777);
}
}
}
return $output;
}
开发者ID:bo-blog,项目名称:bw,代码行数:25,代码来源:zip.inc.php
示例19: afterLoad
/**
* Enable cache de-compression
*
* @param \Magento\Framework\App\PageCache\Cache $subject
* @param string $result
* @return string|bool
* @throws \Magento\Framework\Exception\LocalizedException
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function afterLoad(\Magento\Framework\App\PageCache\Cache $subject, $result)
{
if ($result && strpos($result, self::COMPRESSION_PREFIX) === 0) {
$result = function_exists('gzuncompress') ? gzuncompress(substr($result, strlen(self::COMPRESSION_PREFIX))) : false;
}
return $result;
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:17,代码来源:PageCachePlugin.php
示例20: preAction
function preAction()
{
global $xoopsUser;
xoonips_allow_post_method();
xoonips_deny_guest_access();
$page = $this->_formdata->getValue('post', 'page', 'i', false);
xoonips_validate_request($page > 0);
$resolve_flag = $this->_formdata->getValue('post', 'resolve_conflict_flag', 'i', false);
xoonips_validate_request(1 == $resolve_flag || 0 == $resolve_flag);
$itemtype_handler =& xoonips_getormhandler('xoonips', 'item_type');
foreach ($itemtype_handler->getObjects() as $itemtype) {
if ('xoonips_index' == $itemtype->get('name')) {
continue;
}
$handler =& xoonips_gethandler($itemtype->get('name'), 'import_item');
$handler->create();
}
$sess_hander =& xoonips_getormhandler('xoonips', 'session');
$sess =& $sess_hander->get(session_id());
$session = unserialize($sess->get('sess_data'));
$this->_collection = unserialize(gzuncompress(base64_decode($session['xoonips_import_items'])));
xoonips_validate_request($this->_collection);
$this->_collection->setImportAsNewOption(!is_null($this->_formdata->getValue('post', 'import_as_new', 'i', false)));
$items =& $this->_collection->getItems();
foreach (array_keys($items) as $key) {
if (in_array($items[$key]->getPseudoId(), $this->getUpdatablePseudoId())) {
// set update flag of displayed item
$items[$key]->setUpdateFlag(in_array($items[$key]->getPseudoId(), $this->getUpdatePseudoId()));
}
}
$this->_params[] = $this->_collection->getItems();
$this->_params[] = $xoopsUser->getVar('uid');
$this->_params[] = $this->_collection->getImportAsNewOption();
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:34,代码来源:import_resolve_conflict.class.php
注:本文中的gzuncompress函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论