1.安装 :demo下载路径:https://help.aliyun.com/document_detail/32099.html。
2.配置: 在Application/Common/Conf/config.php内进行相关参数配置。
'ALIOSS_CONFIG' => array(
'KEY_ID' => '', // 阿里云oss key_id
'KEY_SECRET' => '', // 阿里云oss key_secret
'END_POINT' => '', // 阿里云oss endpoint
'BUCKET' => '' // bucken 名称
)
3. 建立ImgUpController.class.php 控制器上传文件。
/** 文件上传
* @param $file
* @return string
*/
public function upload($file)
{
$_FILES = $file;
$upload = new \Think\Upload();// 实例化上传类
// $upload->maxSize = 3145728 ;// 设置附件上传大小
$upload->exts