Coder Social home page Coder Social logo

qiniu's Introduction

七牛组件

准备

composer require qiniu/php-sdk

配置

.env添加配置:

[qiniu]
access_key=xxxx
secret_key=xxx
bucket=test
domain=https://xxx.net
upload_allow_suffix=pdf,doc,docx,xls,xlsx,ppt,pptx
upload_prefix_key=d/
upload_size_limit=10485760
fetch_prefix_key=fetch/

接口

  1. 获取上传Token/qiniu/Upload/getUploadConfigV2。不限制上传到七牛的内容格式,但可以通过allow_suffix来指定前端可用的文件格式。 返回格式:
{
  "status": true,
  "code": 200,
  "data": {
    "key": "d/202306/29172251-$(etag)$(ext)",
    "upload_token": "xxxx",
    "file_size_max_byte": 11534336,
    "file_size_max_mb": 11,
    "allow_suffix": "pdf,doc,docx,xls,xlsx,ppt,pptx",
    "upload_url": "https://up-z2.qiniup.com"
  },
  "msg": "",
  "url": ""
}
  1. 上传回调qiniu/upload/callback,返回内容:
{
    "code": 200,
    "data": {
        "bucket": "xiaofujian",
        "create_time": 1688007021,
        "file_ext": "xlsx",
        "file_name": "xxxx 1.xlsx",
        "file_size": 10922,
        "file_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
        "file_url": "https://xxx.net/dxxxx.xlsx",
        "key": "d/xxxxx.xlsx",
        "uuid": "73e1fab7c3bac42c97d985b06910bbf7"
    },
    "msg": "",
    "status": true,
    "url": ""
}

qiniu's People

Contributors

jayin avatar

Watchers

 avatar 黄振炼 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.