IBOS open source
  • Namespace
  • Class

Namespaces

  • application
    • core
      • cache
        • driver
        • provider
      • components
      • controllers
      • engines
        • local
        • sae
      • model
      • modules
      • utils
      • widgets
    • modules
      • article
        • controllers
        • core
        • model
        • utils
      • calendar
        • controllers
        • model
        • utils
      • contact
        • controllers
        • model
        • utils
      • dashboard
        • controllers
        • model
        • utils
      • department
        • components
        • model
        • utils
      • diary
        • components
        • controllers
        • model
        • utils
        • widgets
      • email
        • controllers
        • core
        • model
        • utils
      • main
        • behaviors
        • components
        • controllers
        • model
        • utils
        • widgets
      • message
        • controllers
        • core
          • co
          • wx
            • callback
            • event
        • model
        • utils
      • mobile
        • components
        • controllers
        • utils
      • position
        • components
        • model
        • utils
      • recruit
        • components
        • controllers
        • core
        • model
        • utils
        • widgets
      • role
        • model
        • utils
      • user
        • components
        • controllers
        • model
        • utils
      • vote
        • components
        • controllers
        • model
        • utils
      • weibo
        • controllers
        • core
        • model
        • utils

Classes

  • SaeFile
  • SaeIo
  • SaeUpload

Class SaeFile

Namespace: application\core\engines\sae
Copyright: Copyright © 2012-2013 IBOS Inc
Author: banyanCheung banyan@ibos.com.cn
Located at system/core/engines/sae/SaeFile.php

Methods summary

public
# __construct( string $domain = 'data', string $ak = '', string $sk = '' )

构造函数,初始化 domain 以及 storage 对象

构造函数,初始化 domain 以及 storage 对象

Parameters

$domain
storage的名称
$ak
accessKey
$sk
secretKey
public static
# getInstance( $domain = 'data', $ak = '', $sk = '' )
public array
# getList( string $dirName, boolean $showAll = false, boolean $showDir = false )

获取文件列表 默认会将文件做筛选,不显示子目录的文件 .txt 表示搜索 所有*.txt / 表示搜索 所有目录 (假设以/结尾则是目录) aaa/ 表示搜索 aaa目录下的文件

获取文件列表 默认会将文件做筛选,不显示子目录的文件 .txt 表示搜索 所有*.txt / 表示搜索 所有目录 (假设以/结尾则是目录) aaa/ 表示搜索 aaa目录下的文件

Parameters

$dirName
$showAll
$showDir

Returns

array
public array
# getFiles( string $dirName, boolean $fold = true )

获取指定目录下的所有文件名

获取指定目录下的所有文件名

Parameters

$dirName
目录名
$fold
为 true 则不遍历子目录

Returns

array

array( 'dirNum'=>'' 'dirNum'=>'' 'dirs'=>array() 'files'=>array() );

public array
# getDirs( string $dirName, boolean $fold = true )

获得文件夹列表

获得文件夹列表

Parameters

$dirName
$fold

Returns

array
public boolean
# uploadFile( type $destFileName, type $srcFileName, type $attr )

上传文件

上传文件

Parameters

$destFileName
$srcFileName
$attr

Returns

boolean
public type
# getFileInfo( string $fileName )

获得文件资料 目前支持的文件属性 - expires: 浏览器缓存超时,功能与Apache的Expires配置相同 - encoding: 设置通过Web直接访问文件时,Header中的Content-Encoding。 - type: 设置通过Web直接访问文件时,Header中的Content-Type。

获得文件资料 目前支持的文件属性 - expires: 浏览器缓存超时,功能与Apache的Expires配置相同 - encoding: 设置通过Web直接访问文件时,Header中的Content-Encoding。 - type: 设置通过Web直接访问文件时,Header中的Content-Type。

Parameters

$fileName
$attr = array (
'type'=>'文件类型',
'length'=>文件长度,
'datetime'=>'添加时间'
)
Array (
[fileName] => bbb/222.txt #文件名
[length] => 1 #文件长度
[datetime] => 1307091828 #添加时间
[type] => text/plain #文件类型
)

Returns

type
public boolean
# isDir( string $dirName )

简单字符串检测是否目录

简单字符串检测是否目录

Parameters

$dirName

Returns

boolean
public boolean
# createDir( string $dirName )

创建 storage 目录

创建 storage 目录

Parameters

$dirName
目录名

Returns

boolean
public type
# createFile( string $fileName, string $content = ' ' )

创建文件

创建文件

Parameters

$fileName
文件名
$content
写入的内容

Returns

type
public boolean
# writeFile( string $file, string $content = ' ', array $attr = array() )

写文件

写文件

Parameters

$file
文件名
$content
写入的内容
$attr
附加参数

Returns

boolean
public boolean
# copyFile( string $old, string $new )

复制文件

复制文件

Parameters

$old
旧文件
$new
新文件

Returns

boolean
public boolean
# renameFile( string $old, string $new )

重命名文件

重命名文件

Parameters

$old
旧文件
$new
新文件

Returns

boolean
public boolean
# renameDir( string $old, string $new )

重命名文件夹

重命名文件夹

Parameters

$old
原来的名称
$new
新名称

Returns

boolean
public type
# moveFile( string $old, string $new )

移动文件

移动文件

Parameters

$old
旧文件
$new
新文件

Returns

type
public type
# readFile( string $file )

读取文件内容

读取文件内容

Parameters

$file
文件名

Returns

type
public boolean
# fileExists( string $file )

文件是否存在在storage中

文件是否存在在storage中

Parameters

$file
文件名

Returns

boolean
public boolean
# dirExists( string $dir = '' )

文件夹是否存在

文件夹是否存在

Parameters

$dir
文件夹名

Returns

boolean
public boolean
# clearDir( string $dir )

清空指定目录里文件 (不包含子目录)

清空指定目录里文件 (不包含子目录)

Parameters

$dir
指定目录

Returns

boolean
public boolean
# deleteFile( string $file )

删除文件

删除文件

Parameters

$file
文件名

Returns

boolean
删除成功与否
public type
# hasChildren( type $dirName )

文件夹是否有子目录

文件夹是否有子目录

Parameters

$dirName

Returns

type
public type
# getMimeType( type $file )

根据文件名获得 mime信息

根据文件名获得 mime信息

Parameters

$file

Returns

type
public string
# fileName( string $path = '' )

获得web访问路径

获得web访问路径

Parameters

$path
要读取的文件名

Returns

string
public integer
# errmsg( )

获取错误代码

获取错误代码

Returns

integer
public string
# formatDir( string $dirName )

格式化目录名

格式化目录名

Parameters

$dirName
目录名

Returns

string
public array
# imageSize( string $image )

图形规格

图形规格

Parameters

$image

Returns

array
public string
# getTempPath( )

获取新浪临时目录路径

获取新浪临时目录路径

Returns

string
public integer
# fileSize( string $file )

获取文件大小

获取文件大小

Parameters

$file
文件名

Returns

integer
public string
# fetchTemp( string $file, sstring $suffix = '' )

读取一个网络文件到临时目录并生成临时文件

读取一个网络文件到临时目录并生成临时文件

Parameters

$file
要读取的文件URL
$suffix
生成临时文件的后缀,为空则自动读取

Returns

string
临时文件地址
public
# download( $attach, $downloadInfo )

Properties summary

protected array $filesInfo
# array()
IBOS open source API documentation generated by ApiGen