php - 适用于 PHP 的 Microsoft Azure SDK 出现错误:未定义类型“MicrosoftAzure\Storage\Blob\BlobRestProxy”
问题描述
我已经安装了 PHP8,并从https://github.com/Azure/azure-storage-php.git克隆了 Microsoftazure SDK 。 如微软文档中所述,我还克隆了https://github.com/Azure-Samples/storage-blobs-php-quickstart.git 。我的文件结构是
-try
--azure-storage-php
--storage-blobs-php-quickstart
--vendor
--composer.json
--composer.lock
--composer.phar
在示例应用程序中,有一个文件名为“phpQS.php”。在这个文件中,我有一个代码
require_once '../vendor/autoload.php';
require_once "./random_string.php";
use MicrosoftAzure\Storage\Blob\BlobRestProxy;
use MicrosoftAzure\Storage\Common\Exceptions\ServiceException;
use MicrosoftAzure\Storage\Blob\Models\ListBlobsOptions;
// use MicrosoftAzure\Storage\Blob\Models\CreateContainerOptions;
use MicrosoftAzure\Storage\Blob\Models\CreateContainerOptions;
use MicrosoftAzure\Storage\Blob\Models\PublicAccessType;
$connectionString = "DefaultEndpointsProtocol=https;AccountName=".getenv('ACCOUNT_NAME').";AccountKey=".getenv('ACCOUNT_KEY');
// Create blob client.
$blobClient = BlobRestProxy::createBlobService($connectionString);
$fileToUpload = "HelloWorld.txt";
if (!isset($_GET["Cleanup"])) {
// Create container options object.
$createContainerOptions = new CreateContainerOptions();
我有错误Undefined type 'MicrosoftAzure\Storage\Blob\BlobRestProxy'
,Undefined type 'MicrosoftAzure\Storage\Blob\Models\CreateContainerOptions'.
我该如何解决这个问题?文件结构或文件本身是否有问题?
解决方案
推荐阅读
- python - 使用带有 Python 的 YouTube 数据 API 打印 YouTube 频道的 ID
- r - 有没有办法将 R 中的单个变量分成两个变量?
- html - CSS如何平滑两个标题之间的过渡
- python - Django 我可以自动填写 list_display
- powerbi - Power Query 条件列 - 为 1 行/输出组合 2 个值
- reactjs - React:将 redux reducer 集成到 dandelion-pro 项目中
- swift - 使用 NSPointToCGPoint 将 NSPoint 转换为 CGPoint
- python - 我的神经网络是过拟合还是欠拟合?
- c# - SharePoint 2019 搜索 REST API 返回 401 Unauthorized - 当使用基本授权请求标头从 C# 调用时
- oracle - 查找转换中的数据类型转换