💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
HisiPHP内置了通用上传方法(upload),通用方法的驱动支持插件式安装,目前官方提供了本地驱动(local)、[七牛云存储(qiniu)](https://store.hisiphp.com/detail/1000029.html)、[阿里云OSS(alioss)](https://store.hisiphp.com/detail/1000031.html),你可以根据自己需求扩展更多的云存储插件。 ## 通用上传方法(upload) >[info] 示例:url('upload', ['driver' => 'local']) 支持以下传参: | 参数 | 类型 | 必须 | 默认 | 说明 | --- | --- | --- | --- | --- | | from | string | N | input | 触发来源,可选值:表单(input)、kindeditor编辑器(kindeditor)、umeditor编辑器(umeditor)、ckeditor编辑器(ckeditor)、ueditor编辑器(ueditor) | | group | string | N | sys | 上传文件分组 | | water | string | N |默认调用系统配置 | 水印设置,可选值:无水印(no)、图片水印(image)、text(文字水印) | | thumb | string | N | 默认调用系统配置 |缩略图,可选值:无缩略图(no)、如需生成 500x500 的缩略图,示例: 500x500多个规格请用";"隔开 | | thumb_type | string | N | 默认调用系统配置 | 缩略图裁剪方式:可选值:1(等比例缩放)、2(缩放后填充)、3(居中裁剪)、4(左上角裁剪)、5(右下角裁剪)、6(固定尺寸缩放) | | input | string | N | file | 文件表单字段名,系统会根据form来源自动判断 | | full_path | string | N | false | 是否需要返回完整的路径(含域名) | | driver | string | N | 默认调用系统配置 | 指定上传驱动 | 如果不想使用内置的通用方法,你可以手动use上传模型,示例: ``` <?php use app\common\model\SystemAnnex; use think\Controller; class upload extends Controller { public function upload() { $param = $this->request->param(); // 调用文件上传方法 $result = SystemAnnex::fileUpload($param); // $result 是返回的上传结果,请根据需要自行打印返回 } } ```