本文整理汇总了PHP中SaeStorage::getListByPath方法的典型用法代码示例。如果您正苦于以下问题:PHP SaeStorage::getListByPath方法的具体用法?PHP SaeStorage::getListByPath怎么用?PHP SaeStorage::getListByPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SaeStorage
的用法示例。
在下文中一共展示了SaeStorage::getListByPath方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SaeStorage
function s_get_dir_file_info($filepath)
{
$_s = new SaeStorage();
//初始化Storage对象
$_f = _s_get_path($filepath);
$_f['filename'] = rtrim($_f['filename'], '/');
return $_s->getListByPath($_f['domain'], $_f['filename']);
}
示例2: getSaeFiles
function getSaeFiles($domain, $path, $allowFiles, &$files = array())
{
$stor = new SaeStorage();
$res = $stor->getListByPath($domain, $path, 1000, 0, false);
foreach ($res as $val) {
$url = $stor->getUrl($domain, $val['fullName']);
$files[] = array('url' => $url, 'mtime' => $val['uploadTime']);
}
return $files;
}
示例3: directories
/**
*
* {@inheritDoc}
* @see \Illuminate\Contracts\Filesystem\Filesystem::directories()
*/
public function directories($directory = null, $recursive = false)
{
list($domain, $path) = $this->parser($directory);
$list = array();
$offset = 0;
do {
$result = $this->storage->getListByPath($domain, $path, 1000, $offset, !$recursive);
foreach ($result['dirs'] as $item) {
$list[] = $domain . '/' . $item['fullName'];
}
$size = sizeof($result['dirNum'] + $result['fileNum']);
$offset += $size;
} while ($size >= 1000);
return $list;
}
示例4: photo
public function photo()
{
$photo = M('photo');
$s = new SaeStorage();
$path = $photo->where('id=' . $_GET['id'])->getField('path');
$list = $s->getListByPath('imgdomain', $path);
$files = $list["files"];
$imgUrlList = array();
foreach ($files as $imageFile) {
$imgUrl = $s->getUrl("imgdomain", $path . "/" . $imageFile['Name']);
array_push($imgUrlList, $imgUrl);
}
$this->assign('list', $imgUrlList);
$this->display();
}
示例5: file_list_upload
/**
* 上传目录列表
* @param string $path 目录名
* @return array
*/
function file_list_upload($path)
{
$config = C('TMPL_PARSE_STRING');
switch (strtoupper(C('FILE_UPLOAD_TYPE'))) {
case 'SAE':
$path = str_replace(DS, '/', rtrim($path, DS));
$arr = explode('/', ltrim($path, './'));
$domain = array_shift($arr);
$filePath = implode('/', $arr);
$s = new SaeStorage();
$list = $s->getListByPath($domain, $filePath);
$res = array();
while (isset($list['dirNum']) && $list['dirNum']) {
$list['dirNum']--;
array_push($res, array('type' => 'dir', 'name' => $list['dirs'][$list['dirNum']]['name'], 'path' => ltrim($list['dirs'][$list['dirNum']]['fullName'], 'upload/'), 'size' => '-', 'mtime' => '-', 'url' => '#'));
}
while (isset($list['fileNum']) && $list['fileNum']) {
$list['fileNum']--;
array_push($res, array('type' => 'file', 'name' => $list['files'][$list['fileNum']]['Name'], 'path' => ltrim($list['files'][$list['fileNum']]['fullName'], 'upload/'), 'size' => format_bytes($list['files'][$list['fileNum']]['length'], ' '), 'mtime' => date('Y-m-d H:i:s', $list['files'][$list['fileNum']]['uploadTime']), 'url' => ltrim($list['files'][$list['fileNum']]['fullName'], 'upload/')));
}
return $res;
break;
case 'FTP':
$storage = new \Common\Plugin\Ftp();
$list = $storage->ls($path);
foreach ($list as &$item) {
$item['path'] = ltrim($item['path'], UPLOAD_PATH);
$item['url'] = str_replace('\\', '/', $item['path']);
}
return $list;
break;
default:
$path = realpath($path);
$path = str_replace(array('/', '\\'), DS, $path);
$list = glob($path . DS . '*');
$res = array();
foreach ($list as $key => $filename) {
array_push($res, array('type' => is_dir($filename) ? 'dir' : 'file', 'name' => basename($filename), 'path' => ltrim(str_replace(realpath(UPLOAD_PATH), '', $filename), DS), 'size' => format_bytes(filesize($filename), ' '), 'mtime' => date('Y-m-d H:i:s', filemtime($filename)), 'url' => ltrim(str_replace(array(realpath(UPLOAD_PATH), '\\'), array('', '/'), $filename), '/')));
}
return $res;
}
}
示例6: GetImages
/**
function GetImages(){
// select folder to scan
$handle = opendir("");
// Read all files and store names in array
while($image =readdir($handle)){
$images[] = $image;
}
closedir($handle);
// Exclude all filenames where filname length<3
$imageArray = array();
foreach($images as $image){
if(strlen($image)>2){
array_push($imageArray,$image);
}
}
// Create <select><option>Values and return result
$result = $this->CreateOptionValues($imageArray);
return $result;
}
**/
function GetImages()
{
$sae_storage = new SaeStorage();
$domainName = "coffee";
$listfiles = $sae_storage->getListByPath($domainName);
$files = $listfiles["files"];
$imageUrls = array();
foreach ($files as $imagefile) {
$tempName = $imagefile["Name"];
$imageUrl = $sae_storage->getUrl($domainName, $tempName);
echo $imageUrl;
array_push($imageUrls, $imageUrl);
}
//$filename = $_FILES["file"]["name"];
//move_uploaded_file($_FILES["file"]["tmp_name"],"images/Coffee/".$filename);
$result = $this->CreateOptionValues($imageUrls);
return $result;
}
示例7: die
case '1':
include_once "./templates/s1.php";
exit;
case '2':
if (phpversion() < 5) {
die('本系统需要PHP5+MYSQL >=4.1环境,当前PHP版本为:' . phpversion());
}
$phpv = @phpversion();
$err = 0;
if ($conn) {
$saeMysql = '<span class="correct_span">√</span> 已开启';
} else {
$saeMysql = '<span class="correct_span error_span">√</span> 未开启';
$err++;
}
if (is_array($s->getListByPath('data'))) {
$storage = '<span class="correct_span">√</span> 已开启';
} else {
$storage = '<span class="correct_span error_span">√</span> 需开启并发创建名称为data的domain';
$err++;
}
if ($kv_ini) {
$KVDB = '<span class="correct_span">√</span> 已开启';
} else {
$KVDB = '<span class="correct_span error_span">√</span> 未开启';
$err++;
}
if ($mmc) {
$Memcache = '<span class="correct_span">√</span> 已开启';
} else {
$Memcache = '<span class="correct_span error_span">√</span> 未开启';
示例8: file_ext
} else {
if (!$s->upload($dir, $newfile, $upload['tmp_name'])) {
$msg = '存储文件失败,请重新上传';
} else {
// $s->getUrl('jesse', $newfile);
$cache[$newfile] = mb_substr($desc, 0, 30, 'UTF-8');
file_put_contents($cachefile, json_encode($cache));
$msg = '上传成功';
$desc = '';
}
}
'上传成功' != $msg && $is_ajax && exit('Error: ' . $msg);
}
// 读取文件
$attaches = array();
$lists = $s->getListByPath($dir);
if (!empty($lists['files'])) {
foreach ($lists['files'] as $l) {
$attaches[] = array('url' => $s->getUrl($dir, $l['fullName']), 'name' => $l['fullName'], 'size' => $l['length']);
}
}
}
function file_ext($s)
{
$exts = array('image/gif' => 'gif', 'image/jpeg' => 'jpg', 'image/png' => 'png', 'image/pjpeg' => 'jpg');
$s = strtolower($s);
return !empty($exts[$s]) ? $exts[$s] : '';
}
if (!$is_ajax) {
?>
<!DOCTYPE html>
示例9: SaeStorageListByNoFoldPath
function SaeStorageListByNoFoldPath($Path)
{
$storage = new SaeStorage();
$domain = Sae_Storage_Domain_Name;
$result = array();
//默认空数组
$limit = 1000;
//列表数量
$offset = 0;
//偏移量
$fold = false;
//不折叠目录
while ($temp = $storage->getListByPath($domain, $Path, $limit, $offset, $fold)) {
foreach ($temp as $file) {
$result[] = $file;
$num++;
}
}
return $result;
}
示例10: put
return false;
} else {
$file['url'] = $st->getUrl($this->domain, $filename);
}
return true;
}
/**
* 文件写入
* @param array $file 文件信息数组
* @param string $data 文件内容
* @param boolean $replace 是否覆盖
* @return boolean 保存状态,true-成功 | false-失败
*/
public function put(&$file, $data, $replace = true)
{
$filename = ltrim($this->rootPath . '/' . $file['save_path'] . $file['save_name'], '/');
$st = new \SaeStorage();
/* 不覆盖同名文件 */