Azure blob 存储与 codeigniter3

问题描述

我正在尝试通过 codeigniter3 访问 microsoft azure blob storage。我从 codeigniter-azure 并遵循流程。我将库文件夹中的文件复制到我的应用程序/库文件夹中,并且还在 application/config/config.PHP 文件添加了 azure account_name,account_key

我在控制器中编写了代码

$this->load->library('azure');
$blob_storage = $this->azure->get_blob_storage();
var_dump($blob_storage -> listBlobs("xxx-container-name-xxx"));

当我执行代码时,我收到错误 Call to a member function get_blob_storage() on null

解决方法

如果您只想列出容器或某个目录下的 blob,您可以轻松生成一个 SAS token,然后使用 Azure blob rest APIs 来执行此操作。 有关如何生成 SAS 令牌并调用其余 API,请参阅 this post。 它不涉及任何其他库,我认为这应该是一种解决方法。