Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/245.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用PHP将文本文件写入Azure中的Blob_Php_Azure_Azure Storage_Azure Storage Blobs - Fatal编程技术网

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

使用PHP将文本文件写入Azure中的Blob,php,azure,azure-storage,azure-storage-blobs,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(我们无法访问系统中的文件)我如何才能做到这一点?将文件保存到磁盘后,您需要将其上载到容器: _s

我正在尝试向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(我们无法访问系统中的文件)我如何才能做到这一点?

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

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

您可以使用WindowsAzure PHP SDK来实现这一点。按照本教程了解更多信息:

但是。。。?问题在哪里?我想写相同的脚本,但它不适用于azure,我没有访问文件系统的权限。但是我如何才能在文件中写入/附加文本?我如何才能完成编写部分?我只能提供文件路径,不能提供内容