简体   繁体   English

PHP-找不到Azure类createcontaineroptions

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

I am following this tutorial on using globs in Azure storage with PHP: 我正在按照本教程使用PHP在Azure存储中使用glob:

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

I used composer to get all the necessary dependencies. 我使用作曲家来获取所有必需的依赖项。 Here is my composer.json: 这是我的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": "*"
    }
}

I do "composer update" and it appears to get everything needed. 我进行“ composer update”,它似乎可以获取所需的一切。

In PHP I do: 在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();

And that gives an error: 这给出了一个错误:

Fatal error: Class 'WindowsAzure\\Blob\\Models\\CreateContainerOptions' not found in C:\\myproject\\azure.php on line 18. 致命错误:在第18行的C:\\ myproject \\ azure.php中找不到类'WindowsAzure \\ Blob \\ Models \\ CreateContainerOptions'。

I did print_r(get_declared_classes()); 我做了print_r(get_declared_classes()); and sure enough, CreateContainerOptions is not in the list. 并且可以肯定的是,CreateContainerOptions不在列表中。

Can you please tell me what is wrong with my require or use statements that it doesn't pull in the CreateContainerOptions class? 您能告诉我我的require或use语句出了什么问题吗,它没有拉到CreateContainerOptions类中?

Thank you! 谢谢!

As the latest version of Azure SDK for PHP, the Storage SDK has changed the repository to https://github.com/Azure/azure-storage-php . 作为适用于PHP的Azure SDK的最新版本,Storage SDK已将存储库更改为https://github.com/Azure/azure-storage-php You can check the structure in vendor/microsoft folder. 您可以在vendor/microsoft文件夹中检查结构。

And also, the namespace of CreateContainerOptions has changed to MicrosoftAzure\\Storage\\Blob\\Models\\CreateContainerOptions . 而且, CreateContainerOptions的命名空间已更改为MicrosoftAzure\\Storage\\Blob\\Models\\CreateContainerOptions Please refer to https://github.com/Azure/azure-storage-php/blob/master/src/Blob/Models/CreateContainerOptions.php#L25 . 请参考https://github.com/Azure/azure-storage-php/blob/master/src/Blob/Models/CreateContainerOptions.php#L25

So, to implement storage operations via latest PHP SDK, please refer to https://github.com/Azure/azure-storage-php . 因此,要通过最新的PHP SDK实现存储操作,请参阅https://github.com/Azure/azure-storage-php

Any further concern, please feel free to let me know. 如有任何其他疑问,请随时告诉我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM