Class vDisk

Description

微盘API

微盘Open API是为第三方开发者提供的一套REST接口,通过该接口任何第三方的公司和个人都可以创建基于微盘的应用.更多相关说明 .

使用方法:

  1.  include_once('vdisk.ex.class.php');
  2.  $appkey 1234567;
  3.  $appsecret '123456739cc20556637a576ea1234567';
  4.  $username 'username@gmail.com';
  5.  $password '123456';
  6.  
  7.  $vdisk new vDisk($appkey$appsecret);
  8.  
  9.  $vdisk->get_token($username$password);
  10.  $_SESSION['token'$vdisk->token;
  11.  
  12.  $vdisk->keep_token();
  13.  
  14.  $r $vdisk->upload_share_file('文件.txt'0);
  15.  $r $vdisk->get_list(0);
  16.  $r $vdisk->get_quota();
  17.  $r $vdisk->upload_with_md5('测试.pdf''03d5717869bb075e3bad73b527fabc8a');
  18.  $r $vdisk->get_file_info(219379);
  19.  $r $vdisk->create_dir('测试一下');
  20.  $r $vdisk->delete_dir(35647);
  21.  $r $vdisk->delete_file(123);
  22.  $r $vdisk->copy_file(2193790'副本.txt');
  23.  $r $vdisk->move_file(2193790'副本.txt');
  24.  $r $vdisk->rename_file(219379'新的新的新的.z');
  25.  $r $vdisk->rename_dir(3929'新的新的新的');
  26.  $r $vdisk->move_dir(3929"我的图片们"0);
  27.  print_r($r);

Located in /vdisk.ex.class.php (line 159)


	
			
Method Summary
void __construct (string $app_key, string $app_secret)
array cancel_share_file (int $fid)
array copy_file (int $fid, int $to_dir_id, string $new_name)
array create_dir (string $create_name, [int $parent_id = 0])
array delete_dir (int $dir_id)
array delete_file (int $fid)
array email_share_file (int $fid, string $to_email)
void errno ()
void error ()
array get_dirid_with_path (string $path)
array get_file_info (int $fid)
array get_list (int $dir_id)
array get_quota ()
array get_token (string $username, string $password, [string $app_type = null])
array keep_token ([string $token = null])
array move_dir (int $dir_id, string $new_name, int $to_parent_id)
array move_file (int $fid, int $to_dir_id, string $new_name)
array recycle_delete_dir (int $dir_id)
array recycle_delete_file (int $fid)
array recycle_get_list ([int $page = 1], [int $page_size = 25])
array rename_dir (int $dir_id, string $new_name)
array rename_file (int $fid, string $new_name)
array restore_dir (int $dir_id)
array restore_file (int $fid)
array share_file (int $fid)
array truncate_recycle ()
array upload_file (string $file_path, int $dir_id, [string $cover = 'yes'])
array upload_share_file (string $file_path, int $dir_id, [string $cover = 'yes'])
array upload_with_sha1 (string $file_name,  $sha1, [int $dir_id = 0], string $md5)
Methods
Constructor __construct (line 198)

构造函数

  • author: Bruce Chen
  • access: public
void __construct (string $app_key, string $app_secret)
  • string $app_key: 分配给你的appkey
  • string $app_secret: 分配给你的appsecret
cancel_share_file (line 799)

取消分享

  • author: Bruce Chen
  • access: public
array cancel_share_file (int $fid)
  • int $fid: 文件的id
copy_file (line 599)

复制文件

  • author: Bruce Chen
  • access: public
array copy_file (int $fid, int $to_dir_id, string $new_name)
  • int $fid: 要复制文件的id
  • int $to_dir_id: 目标目录的id
  • string $new_name: 副本文件的名称
create_dir (line 377)

创建目录

  • author: Bruce Chen
  • access: public
array create_dir (string $create_name, [int $parent_id = 0])
  • string $create_name: 目录的名称
  • int $parent_id: 父目录的id
delete_dir (line 535)

删除目录

  • author: Bruce Chen
  • access: public
array delete_dir (int $dir_id)
  • int $dir_id: 目录的id
delete_file (line 566)

删除文件

  • author: Bruce Chen
  • access: public
array delete_file (int $fid)
  • int $fid: 文件的id
email_share_file (line 1045)

通过邮件发送文件链接

  • author: Bruce Chen
  • access: public
array email_share_file (int $fid, string $to_email)
  • int $fid
  • string $to_email
errno (line 1125)
  • access: public
void errno ()
error (line 1130)
  • access: public
void error ()
get_dirid_with_path (line 1013)

通过路径得到目录

  • author: Bruce Chen
  • access: public
array get_dirid_with_path (string $path)
  • string $path: 路径
get_file_info (line 504)

获得文件的信息

  • author: Bruce Chen
  • access: public
array get_file_info (int $fid)
  • int $fid: 文件的id
get_list (line 410)

获得列表(包括文件和子目录)

  • author: Bruce Chen
  • access: public
array get_list (int $dir_id)
  • int $dir_id: 目录的id
get_quota (line 439)

获得容量信息

  • author: Bruce Chen
  • access: public
array get_quota ()
get_token (line 224)

获得token

  • author: Bruce Chen
  • access: public
array get_token (string $username, string $password, [string $app_type = null])
  • string $username
  • string $password
  • string $app_type: 可选参数, 如:$app_type=sinat (注意: 目前支持微博帐号)
keep_token (line 264)

保持token

  • author: Bruce Chen
  • access: public
array keep_token ([string $token = null])
  • string $token: 可选参数
move_dir (line 735)

移动目录

  • author: Bruce Chen
  • access: public
array move_dir (int $dir_id, string $new_name, int $to_parent_id)
  • int $dir_id: 目录的id
  • string $new_name: 移动后的名称
  • int $to_parent_id: 目标目录的id
move_file (line 634)

移动文件

  • author: Bruce Chen
  • access: public
array move_file (int $fid, int $to_dir_id, string $new_name)
  • int $fid: 要移动文件的id
  • int $to_dir_id: 目标目录的id
  • string $new_name: 移动后的文件名称
recycle_delete_dir (line 920)

从回收站中彻底删除一个目录

  • author: Bruce Chen
  • access: public
array recycle_delete_dir (int $dir_id)
  • int $dir_id: 目录的id
recycle_delete_file (line 890)

从回收站中彻底删除一个文件

  • author: Bruce Chen
  • access: public
array recycle_delete_file (int $fid)
  • int $fid: 文件id
recycle_get_list (line 831)

获得回收站列表

  • author: Bruce Chen
  • access: public
array recycle_get_list ([int $page = 1], [int $page_size = 25])
  • int $page: 第几页
  • int $page_size: 每页显示条数
rename_dir (line 701)

重命名目录

  • author: Bruce Chen
  • access: public
array rename_dir (int $dir_id, string $new_name)
  • int $dir_id: 目录的id
  • string $new_name: 新名称
rename_file (line 668)

重命名文件

  • author: Bruce Chen
  • access: public
array rename_file (int $fid, string $new_name)
  • int $fid: 文件的id
  • string $new_name: 新文件名称
restore_dir (line 983)

从回收站中还原一个目录

  • author: Bruce Chen
  • access: public
array restore_dir (int $dir_id)
  • int $dir_id: 目录的id
restore_file (line 952)

从回收站中还原一个文件

  • author: Bruce Chen
  • access: public
array restore_file (int $fid)
  • int $fid: 文件id
share_file (line 768)

分享文件

  • author: Bruce Chen
  • access: public
array share_file (int $fid)
  • int $fid: 文件的id
truncate_recycle (line 861)

清空回收站

  • author: Bruce Chen
  • access: public
array truncate_recycle ()
upload_file (line 303)

上传文件(10M以下)

  • author: Bruce Chen
  • access: public
array upload_file (string $file_path, int $dir_id, [string $cover = 'yes'])
  • string $file_path: 本地文件真实路径
  • int $dir_id: 目录id
  • string $cover: 可选参数, yes:覆盖; no:如有重名返回错误信息
upload_share_file (line 342)

上传并分享文件(10M以下)

  • return: 包含分享后的url
  • author: Bruce Chen
  • access: public
array upload_share_file (string $file_path, int $dir_id, [string $cover = 'yes'])
  • string $file_path: 本地文件真实路径
  • int $dir_id: 目录id
  • string $cover: 可选参数, yes:覆盖; no:如有重名返回错误信息
upload_with_sha1 (line 471)

无文件上传(md5)

  • author: Bruce Chen
  • access: public
array upload_with_sha1 (string $file_name,  $sha1, [int $dir_id = 0], string $md5)
  • string $file_name: 上传以后的文件名
  • string $md5: 要上传文件的md5值
  • int $dir_id: 目标目录的id, 0为根目录
  • $sha1

Documentation generated on Wed, 03 Sep 2014 10:15:05 +0800 by phpDocumentor 1.4.3