簡體   English   中英

PHP-找不到Azure類createcontaineroptions

[英]PHP - can't find Azure class createcontaineroptions

我正在按照本教程使用PHP在Azure存儲中使用glob:

https://azure.microsoft.com/zh-CN/documentation/articles/storage-php-how-to-use-blobs/

我使用作曲家來獲取所有必需的依賴項。 這是我的composer.json:

{
    "repositories": [
        {
            "type": "pear",
            "url": "https://pear.php.net"
        }
    ],
    "require": {
        "pear-pear.php.net/mail_mime" : "*",
        "pear-pear.php.net/http_request2" : "*",
        "pear-pear.php.net/mail_mimedecode" : "*",
        "microsoft/windowsazure": "*"
    }
}

我進行“ composer update”,它似乎可以獲取所需的一切。

在PHP中,我這樣做:

<?php
require_once 'vendor\autoload.php';


use WindowsAzure\Common\ServicesBuilder;
use WindowsAzure\Blob\Models\CreateContainerOptions;
use WindowsAzure\Blob\Models\PublicAccessType;
use WindowsAzure\Common\ServiceException;

$createContainerOptions = new CreateContainerOptions();

這給出了一個錯誤:

致命錯誤:在第18行的C:\\ myproject \\ azure.php中找不到類'WindowsAzure \\ Blob \\ Models \\ CreateContainerOptions'。

我做了print_r(get_declared_classes()); 並且可以肯定的是,CreateContainerOptions不在列表中。

您能告訴我我的require或use語句出了什么問題嗎,它沒有拉到CreateContainerOptions類中?

謝謝!

作為適用於PHP的Azure SDK的最新版本,Storage SDK已將存儲庫更改為https://github.com/Azure/azure-storage-php 您可以在vendor/microsoft文件夾中檢查結構。

而且, CreateContainerOptions的命名空間已更改為MicrosoftAzure\\Storage\\Blob\\Models\\CreateContainerOptions 請參考https://github.com/Azure/azure-storage-php/blob/master/src/Blob/Models/CreateContainerOptions.php#L25

因此,要通過最新的PHP SDK實現存儲操作,請參閱https://github.com/Azure/azure-storage-php

如有任何其他疑問,請隨時告訴我。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM