繁体   English   中英

尝试使用 PHP 在 Azure Blob 存储上上传时出现问题

[英]Problem tryin to upload on Azure Blob Storage with PHP

我正在尝试将文件上传到 Azure Blob 存储,但我遇到了下一个问题,它在 $blobClient 调用的第一个方法后停止:

$blobClient = BlobRestProxy::createBlobService($connectionString);
//conection string is set correctly

$createContainerOptions = new CreateContainerOptions();
   
$createContainerOptions->setPublicAccess(PublicAccessType::CONTAINER_AND_BLOBS);
      
 
$containerName = "nsf3container"; 
 $target_file="test1.txt";
 $content="aaaa";
    
try {   
    echo "here1 <br>";   
    $blobClient->createBlockBlob($containerName, $target_file, $content);
    echo "here2 <br>"; //it wont print
}catch(ServiceException $e){
         $code = $e->getCode();
         $error_message = $e->getMessage();
         echo $code.": ".$error_message."<br />";
}

我遵循了https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-php?tabs=linux 中的示例教程,但它对我不起作用。 $blobClient 上似乎有问题,但我不知道如何检查或做什么。 有与容器的照片:在此处输入图像描述

暂无
暂无

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

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