本文整理匯總了PHP中gpFiles::GetRaw方法的典型用法代碼示例。如果您正苦於以下問題:PHP gpFiles::GetRaw方法的具體用法?PHP gpFiles::GetRaw怎麽用?PHP gpFiles::GetRaw使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gpFiles
的用法示例。
在下文中一共展示了gpFiles::GetRaw方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: SaveBackup
/**
* Save a backup of the file
*
*/
function SaveBackup()
{
global $dataDir;
$dir = $dataDir . '/data/_backup/pages/' . $this->gp_index;
gpFiles::CheckDir($dir);
$time = time();
if (isset($_REQUEST['revision']) && is_numeric($_REQUEST['revision'])) {
$time = $_REQUEST['revision'];
}
$contents = gpFiles::GetRaw($this->file);
//backup file name
$len = strlen($contents);
$backup_file = $dir . '/' . $time . '.' . $len;
if (isset($this->file_stats['username']) && $this->file_stats['username']) {
$backup_file .= '.' . $this->file_stats['username'];
}
//compress
if (function_exists('gzencode') && function_exists('readgzfile')) {
$backup_file .= '.gze';
$contents = gzencode($contents, 9);
}
gpFiles::Save($backup_file, $contents);
$this->CleanBackupFolder();
}
示例2: SaveBackup
/**
* Save a backup of the file
*
*/
public function SaveBackup()
{
global $dataDir;
$dir = $dataDir . '/data/_backup/pages/' . $this->gp_index;
if ($this->draft_exists) {
$contents = gpFiles::GetRaw($this->draft_file);
$time = $this->draft_stats['modified'];
} else {
$contents = gpFiles::GetRaw($this->file);
$time = $this->file_stats['modified'];
}
//backup file name
$len = strlen($contents);
$backup_file = $dir . '/' . $time . '.' . $len;
if (isset($this->file_stats['username']) && $this->file_stats['username']) {
$backup_file .= '.' . $this->file_stats['username'];
}
//compress
if (function_exists('gzencode') && function_exists('readgzfile')) {
$backup_file .= '.gze';
$contents = gzencode($contents, 9);
}
if (!gpFiles::Save($backup_file, $contents)) {
return false;
}
$this->CleanBackupFolder();
return true;
}