使用PHP将文本文件写入Azure中的Blob

时间:2012-05-31 13:15:25

标签: php azure azure-storage azure-storage-blobs

我正在尝试将文本文件写入blob。我知道我必须创建一个容器和一个blob。我需要写这样的东西:

$text = 'some text';
$myFile = "file.txt";
$fh = fopen($myFile, 'w') or die("can't open file c");
fwrite($fh, $json);
fclose($fh);

问题是我想写这个php脚本但是使用blob(我们无法访问系统文件)我该怎么办?

1 个答案:

答案 0 :(得分:1)

将文件保存到磁盘后,您需要将其上传到容器中:

_storageClient->putBlob('mycontainer', 'file.txt', 'file.txt');

您可以使用Windows Azure PHP SDK执行此操作。请按照本教程获取更多信息: Put a Blob in a Blob Container

相关问题