$options = array(
// 设置文件头
OSS\OssClient::OSS_HEADERS => array(
‘Content-Type’ => ‘text/html; charset=utf-8’,
‘Content-Disposition’ => ‘attachment;filename=ttt.txt’
)
);
$object = ‘1.html’;
$oss = new OSS\OssClient(’aliyun_access_key_id‘, ’aliyun_access_key_secret‘, ’oss_endpoint‘);
//以文件内容上传文件
//oss_bucket,文件位置及文件名,内容,可选项
$oss->putObject(’oss_bucket‘, $object, ‘data’, $options);
//以文件位置上传文件
$oss->uploadFile(’oss_bucket‘, $object , $file[“tmp_name”]);
pathinfo($file[‘image’][‘name’], PATHINFO_EXTENSION);