从谷歌云存储下载文件,并搜索 apies 为 php 的良好文档


Downloading files from google cloud storage and search good documantation by apies for php

我开始使用Google Cloud Storage。

我目前正在使用库Google API PHP Client。

文档在这里,但我找不到与库的 API 相关的任何 php 文档。

而且我在从存储下载文件时遇到问题。我知道如何上传,但我不知道如何下载。

$res = $storage->objects->insert(
        "bucket",
        $obj,
        ['name' => $file_name, 'data' => file_get_contents('path'), 'uploadType' => 'multipart', 'mimeType'=>'text/xml']
    );

我可以获取文件的数据,但无法下载。

$res = $storage->objects->get(
        "bucket",
        $file_name,
        []
    );

谢谢

$storage->objects->get

此 api 返回 mediaLink 参数,通过此链接我们可以从存储中下载