本文整理汇总了PHP中SaeStorage::getAttr方法的典型用法代码示例。如果您正苦于以下问题:PHP SaeStorage::getAttr方法的具体用法?PHP SaeStorage::getAttr怎么用?PHP SaeStorage::getAttr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SaeStorage
的用法示例。
在下文中一共展示了SaeStorage::getAttr方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SaeStorageGetFileAttr
function SaeStorageGetFileAttr($FilePath)
{
$storage = new SaeStorage();
$domain = Sae_Storage_Domain_Name;
$result = $storage->getAttr($domain, $FilePath);
return $result;
}
示例2: modifyHandle
/**
* 修改文件处理函数
*
* @access public
* @param array $content 老文件
* @param array $file 新上传的文件
* @return mixed
*/
public static function modifyHandle($content, $file)
{
if (empty($file['name'])) {
return false;
}
$fileName = preg_split("(\\/|\\|:)", $file['name']);
$file['name'] = array_pop($fileName);
//获取扩展名
$ext = '';
$part = explode('.', $file['name']);
if (($length = count($part)) > 1) {
$ext = strtolower($part[$length - 1]);
}
if ($content['attachment']->type != $ext) {
return false;
}
//获取文件名
$fileName = $content['attachment']->path;
$path = $path . '/' . $fileName;
//add for mkdir
$stor = new SaeStorage();
$options = Typecho_Widget::widget('Widget_Options');
$SaeStorageDomain = $options->plugin('SaeUpload')->saestoragedomain;
if (isset($file['tmp_name'])) {
//移动上传文件
if (!($path = $stor->upload($SaeStorageDomain, $fileName, $file['tmp_name']))) {
return false;
}
} else {
if (isset($file['bits'])) {
//直接写入文件
if (!($path = $stor->write($SaeStorageDomain, $fileName, $file['bits']))) {
return false;
}
} else {
return false;
}
}
if (!isset($file['size'])) {
$attr = $stor->getAttr($SaeStorageDomain, $fileName, array('length'));
$file['size'] = $attr['length'];
}
//返回相对存储路径
return array('name' => $content['attachment']->name, 'path' => $content['attachment']->path, 'size' => $file['size'], 'type' => $content['attachment']->type, 'mime' => $content['attachment']->mime);
}
示例3: size
/**
*
* {@inheritDoc}
* @see \Illuminate\Contracts\Filesystem\Filesystem::size()
*/
public function size($path)
{
list($domain, $path) = $this->parser($path);
$info = $this->storage->getAttr($domain, $path);
return $info ? $info['length'] : false;
}
示例4: json_encode
if (in_array($file_ext, $allow_ext['image']) === true) {
$format = 'image';
} else {
if (in_array($file_ext, $allow_ext['flash']) === true) {
$format = 'flash';
} else {
if (in_array($file_ext, $allow_ext['media']) === true) {
$format = 'media';
} else {
if (in_array($file_ext, $allow_ext['file']) === true) {
$format = 'file';
} else {
$format = 'unknown';
}
}
}
}
$baseInfo = $storage->getAttr($glInfo['domain'], $ret[$i]);
$fileInfo[$i]['file_ext'] = $file_ext;
$fileInfo[$i]['format'] = $format;
$fileInfo[$i]['content_type'] = $baseInfo['content_type'];
$fileInfo[$i]['domain'] = $glInfo['domain'];
$fileInfo[$i]['filename'] = $baseInfo['fileName'];
$fileInfo[$i]['url'] = $storage->getUrl($glInfo['domain'], $ret[$i]);
$fileInfo[$i]['length'] = $baseInfo['length'];
$fileInfo[$i]['datetime'] = $baseInfo['datetime'];
$fileInfo[$i]['md5sum'] = $baseInfo['md5sum'];
$fileInfo[$i]['expires'] = $baseInfo['expires'];
}
}
echo json_encode($fileInfo);