PHP code example of duxphp / duxfiles
1. Go to this page and download the library: Download duxphp/duxfiles library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
duxphp / duxfiles example snippets
$driver = \dux\files\Local::class; //驱动类名
$config = []; //驱动配置
$file = new \dux\Files($driver, $config);
// 本地文件
$driver = \dux\files\LocalDriver::class;
$config = [
'operator' => '', //操作员
'password' => '', //操作员密码
'bucket' => '', //存储空间
'domain' => '', //文件域名
'url' => '', //接口域名
];
// 阿里云 Oss
$driver = \dux\files\OssDriver::class;
$config = [
'access_id' => '',
'secret_key' => '',
'bucket' => '', //存储空间
'domain' => '', //访问域名
'url' => '', //接口域名
];
// 腾讯云 Cos
$driver = \dux\files\CosDriver::class;
$config = [
'secret_id' => '',
'secret_key' => '',
'bucket' => '', //存储空间
'domain' => '', //访问域名
'url' => '', //接口域名
];
// 七牛云存储
$driver = \dux\files\QiniuDriver::class;
$config = [
'access_key' => '',
'secret_key' => '',
'bucket' => '', //存储空间
'domain' => '', //访问域名
'url' => '', //接口域名
];
// 又拍云存储
$driver = \dux\files\UpyunDriver::class;
$config = [
'operator' => '', //操作员
'password' => '', //操作员密码
'bucket' => '', //存储空间
'domain' => '', //文件域名
'url' => '', //接口域名
];
// $path 为文件流或者文件路径、Url
// $name 保存文件路径名,如:\upload\dux.jpg
// $verify 强制文件验证
$file->save($path, $name, $verify = false);
// $name 保存文件路径名,如:\upload\dux.jpg
$file->del($name);